Reactjs – react UseState problem One code is working but another is not working
The above code is not working as expected import { useState } from "react"; function App() { let [Counter, setCounter] = useState(0); const increaseCounter = () => { console.log(Counter, Math.random()); setCounter(Counter++); }; return ( <> <h1>{Counter}</h1> <button onClick={increaseCounter}>++</button> </> );…