I read the posting and something I can’t understand is the difference between setValue(curr + 1)
and setValue(prev => prev + 1)
Is there anybody who can give me an example in reality so that I can test it on my side?
He called setValue inside the event handler, but what if I call it in another?
Is it a good practice for me to use latter one whenever I use useState
?
https://levelup.gitconnected.com/4-usestate-mistakes-you-should-avoid-in-react-0d9d676869e2
Challenger is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.