I’m creating a pokemon memory game with react but I’ve a small problem, when 2 cards is showed, I have to click in another card for hide the 2 cards previously showed. My goal is to choose 2 card, if 2 cards is similar (it work), the card stay showed, if there are not similar I want to wait arround 2 second and hide again. I think I missing some knowledge in react lifecycle
PS: Sorry for my english
Here’s the code : https://github.com/Lukkyz/memory-game/blob/main/src/App.js
Here’s the app : https://lukkyz.github.io/memory-game/
Thank you for you future response
You can hide the cards by setting currentFirst and currentScnd to 0 (I think null would be more semantic, but OK). If they choose a second card and it’s not a match, then use a setTimeout to run a setState to set those to 0 after 1 second. You might want a state flag to disable the cards while that is happening.