***
A virtual DOM is a lightweight JavaScript object which is the copy of the real DOM.
This Virtual DOM works in three simple steps-
i. Whenever any underlying data changes, the entire Ul is
re-rendered in Virtual DOM representation
ii. Then the difference between the previous DOM representation
and the new one is calculated
iii. Once the calculations are done, the real DOM will be updated with only
the things that have actually changed
// dom
- With the HTML DOM, JavaScript can access
and change all the elements of an HTML document.
- The DOM represents the document as nodes and objects; that way,
programming languages can interact with the page.
// virtual dom
- The virtual DOM (VDOM) is a programming concept where an
ideal, or “virtual”, representation of a UI is kept in memory
and synced with the “real” DOM by a library such as ReactDOM.
This process is called reconciliation.