MCPcopy Create free account
hub / github.com/epicweb-dev/react-suspense / ShipButtons

Function ShipButtons

exercises/04.image/02.solution.error/index.tsx:37–59  ·  view source on GitHub ↗
({
	shipName,
	onShipSelect,
}: {
	shipName: string
	onShipSelect: (shipName: string) => void
})

Source from the content-addressed store, hash-verified

35}
36
37function ShipButtons({
38 shipName,
39 onShipSelect,
40}: {
41 shipName: string
42 onShipSelect: (shipName: string) => void
43}) {
44 const ships = ['Dreadnought', 'Interceptor', 'Galaxy Cruiser']
45
46 return (
47 <div className="ship-buttons">
48 {ships.map((ship) => (
49 <button
50 key={ship}
51 onClick={() => onShipSelect(ship)}
52 className={shipName === ship ? 'active' : ''}
53 >
54 {ship}
55 </button>
56 ))}
57 </div>
58 )
59}
60
61function ShipDetails({ shipName }: { shipName: string }) {
62 const ship = use(getShip(shipName))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected