diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-15 17:10:20 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-15 17:10:20 +0530 |
commit | 919da0bb7ef807a5c79f0eb95c45044420e6b80a (patch) | |
tree | 15da03dbb5c2a80731079eab79d6fc5def79e43d /src | |
parent | d76551fade9c2267b48ce541ec069082b2d72ee8 (diff) |
fixed error when board does not clear on Firefox mobile
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Grid.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
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(() => { |