DEV Community

Discussion on: How to pass state between components in reactjs

Collapse
 
chiangs profile image
Stephen Chiang

setState happens asynchronously... Therefore you need to use previous state first to ensure you are using the latest if you are going to calculate the state based on previous state.

Thread Thread
 
uranium93 profile image
uranium93

Yes this is it
Thank you