DEV Community

Cover image for What is Virtual DOM? Difference between virtual DOM and real DOM?
Md Shah Jalal
Md Shah Jalal

Posted on

What is Virtual DOM? Difference between virtual DOM and real DOM?

In simple words, virtual DOM is just a copy of the original DOM kept in the memory and synced with the real DOM by libraries such as React DOM. This process is called Reconciliation.
Reconciliation is a process to compare and keep in sync the two files (Real and Virtual DOM). Diffing algorithm is a technique of reconciliation that is used by React.

Real DOM

  • DOM is a language-neutral interface allowing programs and scripts to dynamically access and update multiple objects like content, structure, and style of a document.
  • The DOM denotes the document as nodes and objects.
  • It is an object-oriented representation of a web page, modified with a scripting language like JavaScript.

Virtual DOM

  • Is a collection of modules designed to provide a declarative way to represent the DOM for an application.
  • A virtual DOM object is a representation of a DOM object, like a lightweight copy.
  • Virtual DOM is ideal for mobile-first applications.

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay