skip to Main Content

I am going through lot of articles over the internet asking the difference between the two, but almost everyone of them explains the difference between Virual DOM and Real DOM. According to my current knowledge, VirtualDOM is just a software concept where a separate copy of Real DOM is maintained…
Is ReactDOM just an implementation of the Virtual DOM ?

2

Answers


  1. Yes, the Virtual DOM is a concept used in web development, and ReactDOM is a specific implementation of that concept in the context of React, which is a JavaScript library for building user interfaces.

    • Real DOM:
      The Real DOM (Document Object Model) is a representation of the structure of a web page. It’s a hierarchical tree-like structure where each element on the web page is a node in the tree.
      When there are changes to the state of a web page (due to user interaction or other events), the Real DOM updates, and the entire page might need to be re-rendered.

    • Virtual DOM:
      The Virtual DOM is a programming concept. It involves creating a virtual representation of the Real DOM in memory.
      Instead of directly manipulating the Real DOM every time a change occurs, React uses a Virtual DOM to perform the updates more efficiently.
      When there’s a change in the application state, React first updates the Virtual DOM rather than the Real DOM.
      (https://legacy.reactjs.org/docs/faq-internals.html)

    • ReactDOM:
      ReactDOM is the specific implementation of React that is responsible for updating the Real DOM based on changes in the Virtual DOM.
      ReactDOM takes care of efficiently updating only the parts of the Real DOM that have changed, rather than re-rendering the entire page.
      It acts as a bridge between the virtual representation of the DOM that React works with and the actual DOM in the browser. (https://it.legacy.reactjs.org/docs/react-dom.html)

    Login or Signup to reply.
  2. AFAI the ReactDom is an implementation of a VirtualDom. The VirtalDom is just a concept. The following is from this old react documentation: https://legacy.reactjs.org/docs/faq-internals.html

    Since “virtual DOM” is more of a pattern than a specific technology, people sometimes say it to mean different things. In React world, the term “virtual DOM” is usually associated with React elements since they are the objects representing the user interface. React, however, also uses internal objects called “fibers” to hold additional information about the component tree. They may also be considered a part of “virtual DOM” implementation in React.

    I hope this clears out some thinks

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search