What is the difference between Virtual DOM and ReactDOM?

135 views Asked by At

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

There are 2 answers

0
Pascal Thurow On

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

1
Nidhi On

The Virtual DOM is a concept used in React to enhance performance by maintaining a lightweight, in-memory representation of the actual Document Object Model (DOM). When modifications are made to the user interface, React applies these changes to the Virtual DOM first, allowing it to efficiently compare the current and previous states to determine the minimal updates required. On the other hand, ReactDOM is a specific module within the React library that handles the rendering and updating of React elements in the real DOM. It works in tandem with the Virtual DOM, using methods like ReactDOM.render() to reflect changes in the user interface on the actual browser display. In essence, the Virtual DOM is a strategic concept, while ReactDOM serves as the practical implementation for managing interactions with the browser's DOM.