Skip to content

Commit

Permalink
Merge pull request #491 from kavya-gaur/main
Browse files Browse the repository at this point in the history
Start Button Commit
  • Loading branch information
panwar8279 authored Jun 14, 2023
2 parents 4619788 + 7511056 commit 0d60ed9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Games/Memory/memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ export default function Memory() {
const [pos, setPos] = useState(0);
const [sequence, setSequence] = useState([]);
const [status, setStatus] = useState("playing");
const [startbtn,setStartButton] = useState(false);

const delay = (ms) => new Promise((res) => setTimeout(res, ms));

useEffect(() => {
startGame();
if(startbtn)startGame();
}, [level]);

const handleClick = async (x) => {
Expand Down Expand Up @@ -57,7 +58,10 @@ export default function Memory() {
<h1 className="h">Memory Game</h1>
<button
className="start-btn"
onClick={startGame}
onClick={()=>{
startGame();
setStartButton(true);
}}
>
Start
</button>
Expand Down

0 comments on commit 0d60ed9

Please sign in to comment.