From 919da0bb7ef807a5c79f0eb95c45044420e6b80a Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Thu, 15 Jul 2021 17:10:20 +0530
Subject: fixed error when board does not clear on Firefox mobile

---
 src/components/Grid.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/components/Grid.tsx')

diff --git a/src/components/Grid.tsx b/src/components/Grid.tsx
index 9ac881d..1e06ea6 100644
--- a/src/components/Grid.tsx
+++ b/src/components/Grid.tsx
@@ -62,13 +62,13 @@ const Grid: React.FC<Props> = (props) => {
 
   const endGame = (winner: number) => {
     const gameWinner = winner < 2 ? (winner === 1 ? "X" : "O") : "Draw";
-    alert(`WINNER: ${gameWinner}`)
+    // clean up before alerting
+    setBoard([2,2,2,2,2,2,2,2,2]);
+    setWinner(2);
     gameWinner === "Draw" || gameWinner === "X" 
       ? props.setScoreX(props.scoreX + 1) 
       : props.setScoreO(props.scoreO + 1)
-    // clean up
-    setBoard([2,2,2,2,2,2,2,2,2]);
-    setWinner(2);
+    alert(`WINNER: ${gameWinner}`)
   }
 
   useEffect(() => {
-- 
cgit v1.2.3

