Virtual Dom

Virtual DOM is an ideal representation of UI that is kept in memory. Once any update is made to the virtual DOM it is synced with the real DOM to show it on the screen.

  • The process of updating is followed like this:
    • The update is passed to the virtual DOM.
    • Virtual DOM checks if anything is actually updated by comparing the current virtual DOM and the pre-updated virtual DOM before updating the real DOM. This process is called diffing.
    • If anything was actually updated then the real DOM is synced with the virtual DOM. Here syncing will update only those parts of the DOM which have been updated in the virtual DOM rather than updating the whole DOM.
  • Read more about Virtual DOM through these references: