最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - When does code inside useEffect execute? Before re-paint or after? - Stack Overflow

programmeradmin0浏览0评论

I am confused about this sentense in /

Even if your Effect was caused by an interaction (like a click), React may allow the browser to repaint the screen before processing the state updates inside your Effect.

What does "the state updates inside your Effect" mean by here? I think here what the doc want to express is that the click update the state, then react re-render, then the browser repaint, then the code inside useEffect execute. Why is there also state updates inside Effect? Is here a mistake, which was suppose to be "React may allow the browser to repaint the screen before processing the code inside your Effect."

发布评论

评论列表(0)

  1. 暂无评论