Skip to content

Commit 9fb4e81

Browse files
committed
chore: added PR feedback
1 parent 4195248 commit 9fb4e81

File tree

1 file changed

+16
-12
lines changed
  • workspaces/simon-game/src/app/components

1 file changed

+16
-12
lines changed

workspaces/simon-game/src/app/components/App.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@ import { playNote } from "../util/playNote.ts";
55
import { config } from "../constants.ts";
66

77
export function App() {
8-
const [playerMoves, setPlayerMoves] = useState<number[]>([]);
8+
const [playerMoves, setPlayerMoves] = useState<readonly number[]>([]);
99
return (
10-
<div style={{ display: "flex", gap: 10 }}>
11-
{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>
10+
<>
11+
<div style={{ display: "flex", gap: 10 }}>
12+
{config.boxes.map((box, index) => (
13+
<Box
14+
key={index}
15+
color={box.color}
16+
onClick={() => {
17+
playNote(box.frequency);
18+
setPlayerMoves((prev) => [...prev, index]);
19+
}}
20+
/>
21+
))}
22+
</div>
23+
<pre>{JSON.stringify(playerMoves, null, 2)}</pre>
24+
</>
2125
);
2226
}

0 commit comments

Comments
 (0)