Skip to content
loading...

re: Learning React Hooks 1 useState VIEW POST

FULL DISCUSSION
 

This post is just horribly wrong on setting state
every React developer should use call back function when the new state value is referencing the old state, that's the basic

this.setState(({counter})=>({ counter: prevCount + 10}))
setCount(({counter})=>({ counter: prevCount + 10}))
code of conduct - report abuse