From 23bc04e660b9043c56e83de90d3a8deaf7861292 Mon Sep 17 00:00:00 2001 From: Jeffrey Date: Wed, 17 Jul 2024 21:45:55 -0400 Subject: [PATCH] fix react bug --- src/context/QuizProvider.tsx | 2 +- src/hooks/useTimer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context/QuizProvider.tsx b/src/context/QuizProvider.tsx index 28b3aac..5be6a62 100644 --- a/src/context/QuizProvider.tsx +++ b/src/context/QuizProvider.tsx @@ -33,7 +33,7 @@ const QuizProvider = ({ children }: QuizProviderProps) => { useEffect(() => { setTimer(totalTime) setQuestions(quizQuestions) - }, [quizTopic]) + }, [quizTopic, totalTime, quizQuestions]); const quizDetails = { totalQuestions, diff --git a/src/hooks/useTimer.ts b/src/hooks/useTimer.ts index 5dee3e1..ac22788 100644 --- a/src/hooks/useTimer.ts +++ b/src/hooks/useTimer.ts @@ -28,7 +28,7 @@ const useTimer = ( }, 1000) return () => clearTimeout(countTimer) } - }, [timer, setTimer]) + }, [timer, setTimer, showResultModal]) } export default useTimer