0 votes
in JAVA by
How React works? How Virtual-DOM works in React?

1 Answer

0 votes
by

React creates a virtual DOM. When state changes in a component it firstly

runs a “diffing” algorithm, which identifies what has changed in the virtual

DOM. The second step is reconciliation, where it updates the DOM with the

results of diff.

The HTML DOM is always tree-structured — which is allowed by the

structure of HTML document. The DOM trees are huge nowadays because of

large apps.

The Virtual DOM is an abstraction of the HTML DOM. It is lightweight and

detached from the browser-specific implementation details.

...