Core React#28 · Questions adapted from sudheerj/reactjs-interview-questions (MIT)
What is reconciliation?
Reconciliation
is the process through which React updates the Browser DOM and makes React work faster. React use a
diffing algorithm
so that component updates are predictable and faster. React would first calculate the difference between the
real DOM
and the copy of DOM
(VirtualDOM)
when there's an update of components.
React stores a copy of Browser DOM which is called
VirtualDOM
. When we make changes or add data, React creates a new Virtual DOM and compares it with the previous one. This comparison is done by
DiffingAlgorithm
.
Now React compares the Virtual DOM with Real DOM. It finds out the changed nodes and updates only the changed nodes in Real DOM leaving the rest nodes as it is. This process is called Reconciliation.