'React re-render vs function re-evaluation
Could someone validate if my assumptions after docs and tutorials reading are correct? First of all I would like to introduce some terminology:
reevaluation
is when react updates its VirtualDOM and happens when
- component is not memoized and parent component re-evaluates (not necessary props must change)
- component is memoized and its props/state changes
- component's state changes
So rerender
is when react updates DOM and happens when:
- re-evaluated virtual DOM node is different than DOM node
Could you confirm am I right?
Solution 1:[1]
Re-Evaluating Components != Re-Rendering DOM
Components get re-evaluated whenever props, state, or context changes
DOM re-render when there is difference between evaluations
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Faisal Amin |