From 3bac42a96850b5839f7d4cde71ba819202845bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Garc=C3=ADa?= <58784148+algarfer@users.noreply.github.com> Date: Thu, 14 Mar 2024 03:02:20 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=8F=F0=9F=99=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/src/views/Game.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/webapp/src/views/Game.jsx b/webapp/src/views/Game.jsx index 9e37702a..ceaa51ae 100644 --- a/webapp/src/views/Game.jsx +++ b/webapp/src/views/Game.jsx @@ -30,11 +30,10 @@ export default function Game() { const timerId = useRef(); + const navigate = useNavigate(); // Next question const next = useCallback(() => { - const navigate = useNavigate(); - if (current === questions.length - 1) { navigate("/menu"); } @@ -42,7 +41,7 @@ export default function Game() { setCurrent(current + 1); setTimeLeft(initialTime); setProgressBarPercent(0); - }, [current, questions.length, initialTime]); + }, [current, questions.length, initialTime, navigate]); // Timer useEffect(() => {