If I was right, the Virtual DOM
in ReactJS compares the previous DOM
with the current DOM i.e, formed after a change in state tree. Then why the child components rerenders when there is change in parent props.
If virtual DOM renders only the DOM that is not already rendered, why should I use shouldComponentUpdate()
method.
I have watched many videos on this but I didn't get exact way they behave. It would be a great pleasure if someone can clearly explain the following doubts.
1) Does virtual DOM every-time renders only the components which are not already rendered or will there be any exceptions?
2)If virtual DOM every-time renders only the components which are not already rendered, why the child components re-renders when there is change in parent props?
3)When should I use shouldComponentUpdate()
?