Skip to content

Commit

Permalink
stop mahjong timer if you run out of moves
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan4m1 committed Jan 1, 2024
1 parent fcacf22 commit eb7a70a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/mahjongBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ export default function MahjongBoard({ images }) {
}, [layout]);

useEffect(() => {
setFailed(matches === 0);
if (matches === 0) {
setFailed(true);
stopTimer();
}
}, [matches]);

return (
Expand Down

0 comments on commit eb7a70a

Please sign in to comment.