React JS ReactDOM (original) (raw)

Last Updated : 09 Jan, 2025

**ReactDom is a **core react package that **provides methods to interact with the Document Object Model or DOM. This package allows developers to **access and modify the DOM. Let's see in brief what is the need to have the package.

Table of Content

**What is ReactDOM ?

**The ReactDOM in React is responsible for **rendering the elements or Components in the actual DOM of the web page. It is a package in React that **provides DOM-specific methods that can be used at the top level of a web app to enable an efficient way of managing DOM elements of the web page. ReactDOM provides the developers with an API containing the various methods to manipulate DOM.

How to use ReactDOM ?

To use the ReactDOM in any React web app we must first install the react-dom package in our project. To install the react-dom package use the following command.

// Installing
npm i react-dom

After installing the package use the following command to import the package in your application file

// Importing
import ReactDOM from 'react-dom'

After installing **react-dom it will appear in the **dependenices in **package.json file like:

"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
}

**Why ReactDOM is used ?

Earlier, React Developers directly manipulated the DOM elements which resulted in frequent DOM manipulation, and each time an update was made the browser had to recalculate and repaint the whole view according to the particular CSS of the page, which made the total process to consume a lot of time.

To solve this issue, React brought into the scene the virtual DOM. The **Virtual DOM can be referred to as a copy of the actual DOM representation that is used to hold the updates made by the user and finally reflect it over to the original Browser DOM at once consuming much lesser time.

Important Methods of ReactDOM

**Features

Use Case

Summary

ReactDom is a core part of React responsible for rendering the elements on DOM efficiently form the virtualDOM. It also provides method for dynamically access and manage the DOM of the application.