From 0752a684bbe91c11b11464e6438867ba04f85af8 Mon Sep 17 00:00:00 2001 From: Ronak Hingonia <158851792+07ronak@users.noreply.github.com> Date: Thu, 25 Jul 2024 01:24:59 +0530 Subject: [PATCH] Update App.jsx Adding a Debounce Mechanism: This prevents a bug in the game where a user can exploit the game mechanics by rapidly double-clicking on a single upside-down card. This triggers the card and its matching pair to flip over automatically, resulting in an unintended match. --- memento/src/App.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memento/src/App.jsx b/memento/src/App.jsx index 357522c..c458a0c 100644 --- a/memento/src/App.jsx +++ b/memento/src/App.jsx @@ -14,7 +14,7 @@ function App() { // Handle card selection const handleClick = (card) => { - if (!disabled) { + if (!disabled && card !== pickOne && !card.matched) { pickOne ? setPickTwo(card) : setPickOne(card); } };