https://facebook.imtqy.com/react/docs/react-component.html#setstate
It seems to me that the official document says:
The second parameter to setState () is an optional callback function that will be executed after setState completes and the component is rendered again. We usually recommend using componentDidUpdate () for this logic.
why do they recommend using componentDidUpdate instead of a callback when we need to use the last state?
source
share