From 9a6fc17a7115e113ef46d9f37ea97d71a5949ea5 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Tue, 21 Nov 2023 10:37:10 +0100 Subject: [PATCH] Updated the Game.jsx --- client/src/pages/Game/Game.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/pages/Game/Game.jsx b/client/src/pages/Game/Game.jsx index 82a6335..d6a26cb 100644 --- a/client/src/pages/Game/Game.jsx +++ b/client/src/pages/Game/Game.jsx @@ -12,7 +12,7 @@ export const Game = () => { const {groups, allGroups} = useContext(GroupContext); const [currentState, setCurrentState] = useState("hint"); - + const [currentRound, setCurrentRound] = useState(0); const {musicEnabled} = useContext(MusicContext); @@ -24,6 +24,10 @@ export const Game = () => { return () => clearTimeout(timeout); }, []); + useEffect(() => { + if (currentState === "waiting") setCurrentRound(current => current + 1); + }, [currentState]); + if (groups.length === 0 && allGroups.length === 0) return ; @@ -37,7 +41,7 @@ export const Game = () => { } {currentState === "waiting" && } - {currentState === "calculate" && } + {currentState === "calculate" && } ) } \ No newline at end of file