Reputation: 2024
Lets say I have a render method in which I display some state. The state is a huge html tree built from some API call. Then I want to rerender it with a small change. Is the whole html tree rerendered, or only this small portion?
Upvotes: 0
Views: 37
Reputation: 5018
If you only modify the small part of the state that is associated with your change, only the portion of the view that depends on it will be re-rendered.
The entire View will not be re-rendered.
This is because of how react works. After every state change react constructs a virtual DOM and diffs it with the old DOM. And only the differences are rendered.
https://facebook.github.io/react/docs/advanced-performance.html#avoiding-reconciling-the-dom
Upvotes: 1