Reputation: 95
When the render method is called, that generates the virtual DOM representation.
Is this new virtual DOM compared against the past virtual DOM representation or against the real DOM?
If the response is against the real DOM, why when I modify something manually on the Chrome DevTools, React doesn't recognize that change and restore it to the original state.
This question is based on the second 21:28 of this video: https://youtu.be/vFbf-_FFuZ4?t=21m28s
Upvotes: 1
Views: 64
Reputation: 46
The virtual DOM is compare with an in-memory representation.
React is very fast because it never talks to the DOM directly. React maintains a fast in-memory representation of the DOM. render() methods actually return a description of the DOM, and React can compare this description with the in-memory representation to compute the fastest way to update the browser.
Reference: [https://www.udemy.com/react-flux/learn/v4/overview]
Upvotes: 3