Puneet Kankar
What is reconciliation in react?

When a react component’s props or state change, React decides whether an actual DOM update is necessary by comparing the newly returned element with the previously rendered one. When they are not equal, React will update the DOM. This process is called reconciliation.

By Puneet Kankar in React on Dec 28 2022
  • Tuhin Paul
    Feb, 2023 22

    Reconciliation is the process by which React updates the DOM to reflect changes in the component tree.

    In React, when a component’s state or props change, React performs a process called “reconciliation” to determine what changes need to be made to the DOM. React does not update the entire DOM for every change; instead, it calculates the difference between the previous and current component tree and updates only the parts of the DOM that need to be changed.

    The reconciliation process starts by comparing the old virtual DOM with the new virtual DOM to identify the differences between them. Then, React updates the real DOM by making only the necessary changes. This process is very efficient because it avoids unnecessary updates to the DOM and ensures that the user interface is always up to date.

    During the reconciliation process, React uses a set of heuristics to minimize the number of DOM updates needed. For example, React may reuse DOM elements whenever possible instead of creating new ones, or it may batch multiple updates together to minimize the number of times the DOM needs to be updated.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS