简体   繁体   中英

React setState callback and render execution order

In Reactjs after invoking setState which method will call first. setState callback or render function?

Render first, then setState callback. SetState is async in the sense that it will wait for the render to finish to execute the callback. You can find more info here: https://reactjs.org/docs/react-component.html#setstate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM