ReactJS - Does render get called any time “setState” is called?

后端 未结 7 898
攒了一身酷
攒了一身酷 2020-11-22 14:51

Does React re-render all components and sub components every time setState() is called?

If so, why? I thought the idea was that React only rendered as li

相关标签:
7条回答
  • 2020-11-22 15:26

    Not All Components.

    the state in component looks like the source of the waterfall of state of the whole APP.

    So the change happens from where the setState called. The tree of renders then get called from there. If you've used pure component, the render will be skipped.

    0 讨论(0)
提交回复
热议问题