Reactjs – React State Not Updating in Function
Using React, I am trying to make a chess website. Inside my App function, I have the following code: const [playerSide, setPlayerSide] = useState('White'); function switchPlayerSide() { console.log('in switch, ' + playerSide); setPlayerSide(playerSide === 'Black' ? 'White' : 'Black'); }…