diff --git a/src/components/BoardSwitcher.jsx b/src/components/BoardSwitcher.jsx
index e99793a..2a2776a 100644
--- a/src/components/BoardSwitcher.jsx
+++ b/src/components/BoardSwitcher.jsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React, { useState } from "react";
function Board(props) {
let className = "board";
@@ -10,16 +10,28 @@ function Board(props) {
}
function BoardSwitcher(props) {
+ // State to track the currently selected board
+ const [selectedBoard, setSelectedBoard] = useState(0);
+
+ // Event handler for the toggle button
+ const handleToggle = () => {
+ // Update the selected board (increment by 1, loop back to 0)
+ setSelectedBoard((prevSelectedBoard) =>
+ (prevSelectedBoard + 1) % props.numBoards
+ );
+ };
+
let boards = [];
for (let ii = 0; ii < props.numBoards; ii++) {
- let isSelected = ii === 0;
+ let isSelected = ii === selectedBoard;
boards.push(