We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcd1abe commit 4195248Copy full SHA for 4195248
workspaces/simon-game/src/app/components/App.tsx
@@ -1,14 +1,21 @@
1
-import React from "react";
+import React, { useState } from "react";
2
3
import { Box } from "./Box.tsx";
4
import { playNote } from "../util/playNote.ts";
5
import { config } from "../constants.ts";
6
7
export function App() {
8
+ const [playerMoves, setPlayerMoves] = useState<number[]>([]);
9
return (
10
<div style={{ display: "flex", gap: 10 }}>
- {config.boxes.map((box) => (
11
- <Box color={box.color} onClick={() => playNote(box.frequency)} />
+ {config.boxes.map((box, index) => (
12
+ <Box
13
+ color={box.color}
14
+ onClick={() => {
15
+ playNote(box.frequency);
16
+ setPlayerMoves([...playerMoves, index]);
17
+ }}
18
+ />
19
))}
20
</div>
21
);
0 commit comments