Reputation: 506
Please correct me anywhere if i am wrong.
React has a virtual dom and if anything changes it compares those changes with the new virtual dom and apply those changes in minimal number of steps to the real dom.
So does it has two copies always or with each re-render a new virtual dom is made and it compares with the previous latest one.
Upvotes: 0
Views: 113
Reputation: 1661
Yes, the virtual DOM and the browser DOM are basically copies, the virtual DOM being an abstraction of the browser DOM, which in turn is an abstraction of an HTML document.
Here's an analysis of how React determines which components and DOM nodes to update
This post examines the difference between the browser DOM and the virtual DOM
(Both links are easily found with a little Googling)
Upvotes: 1