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

Function ShipButtons

exercises/02.dynamic/03.problem.flash/index.tsx:36–58  ·  view source on GitHub ↗
({
	shipName,
	onShipSelect,
}: {
	shipName: string
	onShipSelect: (shipName: string) => void
})

Source from the content-addressed store, hash-verified

34}
35
36function ShipButtons({
37 shipName,
38 onShipSelect,
39}: {
40 shipName: string
41 onShipSelect: (shipName: string) => void
42}) {
43 const ships = ['Dreadnought', 'Interceptor', 'Galaxy Cruiser']
44
45 return (
46 <div className="ship-buttons">
47 {ships.map((ship) => (
48 <button
49 key={ship}
50 onClick={() => onShipSelect(ship)}
51 className={shipName === ship ? 'active' : ''}
52 >
53 {ship}
54 </button>
55 ))}
56 </div>
57 )
58}
59
60function ShipDetails({ shipName }: { shipName: string }) {
61 // 💯 Set different delays for different ships. Feel free to play around with the values.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected