Skip to content

Instantly share code, notes, and snippets.

@syeo66
Created April 25, 2019 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syeo66/8e3d6999f3fc11cb2fbcd023769406f3 to your computer and use it in GitHub Desktop.
Save syeo66/8e3d6999f3fc11cb2fbcd023769406f3 to your computer and use it in GitHub Desktop.
Add 2 to the counter... the wrong way
const [counter, setCounter] = useState(0);
const handleClick = () => {
setCounter(counter + 1);
setCounter(counter + 1);
}
console.log(counter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment