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

Function ShipButtons

exercises/02.dynamic/01.solution.cache/index.tsx:33–55  ·  view source on GitHub ↗
({
	shipName,
	onShipSelect,
}: {
	shipName: string
	onShipSelect: (shipName: string) => void
})

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected