React Virtual DOM

In React, whenever we tell React to make a change to the UI via setState or some other mechanism, the virtual DOM is updated first, and then the real DOM is updated to match the changes in the virtual DOM. This process is called “reconciliation”.

When updates are made to the virtual DOM, React uses a diffing algorithm to identify the differences between the old and new versions of the virtual DOM. This algorithm then determines the minimal set of changes required to update the real DOM, and these changes are applied in a batched and optimized way to minimize the performance impact.