Registry / web-framework / react-dom

react-dom

JSON →
library19.2.5jsnpmunverified

react-dom is the entry point for React applications when rendering to the DOM. It provides DOM-specific methods needed to manage and update the browser's DOM. The current stable version is 19.2.5. It receives frequent patch releases, often in sync with the `react` package and other related tools.

npm install react-dom
INSTALL
IMPORT
SIG · REACT-DOM
R
react-dom
web-frameworkjavascriptv19.2.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createRoot
import { createRoot } from 'react-dom/client'
import { render } from 'react-dom'
For React 18+ applications, use createRoot for initial rendering.
hydrateRoot
import { hydrateRoot } from 'react-dom/client'
For hydrating server-rendered React applications (React 18+).
ReactDOM
import ReactDOM from 'react-dom'
Primarily for legacy APIs like ReactDOM.render or when accessing other ReactDOM methods not available via react-dom/client.

Demonstrates how to render a basic React component into a DOM element using `createRoot`, the recommended method for React 18+ applications.

import { createRoot } from 'react-dom/client'; import React from 'react'; function App() { return <h1>Hello, React 19!</h1>; } const container = document.getElementById('root'); if (container) { const root = createRoot(container); root.render(<App />); } else { console.error('Root element not found in the DOM.'); }
Debug
Known issues
breaking`ReactDOM.render` and `ReactDOM.hydrate` are deprecated in React 18+ and will be removed in a future major release. They are replaced by `createRoot` and `hydrateRoot` respectively.
fix
Migrate from `ReactDOM.render(<App />, container)` to `import { createRoot } from 'react-dom/client'; const root = createRoot(container); root.render(<App />);`
affects: >=18.0.0
gotcha`react-dom` has a peer dependency on `react`. Ensure you have `react` installed at a compatible version to avoid installation issues or runtime errors.
fix
Install `react` alongside `react-dom` with a matching major version, e.g., `npm install react@^19.2.5` or `yarn add react@^19.2.5`.
affects: *
gotcha`eslint-plugin-react-hooks@7.1.0` accidentally removed the `component-hook-factories` rule, causing errors for users who referenced it in their ESLint config. This was fixed in `7.1.1`.
fix
Upgrade `eslint-plugin-react-hooks` to `7.1.1` or later: `npm install eslint-plugin-react-hooks@latest`.
affects: eslint-plugin-react-hooks@7.1.0
Errors
Common errors & fixes
Error: ReactDOM.render is no longer supported in React 18. Use createRoot instead.
Attempting to use the legacy `ReactDOM.render` API in a React 18+ application.
fix
Replace `ReactDOM.render(<App />, document.getElementById('root'));` with: `import { createRoot } from 'react-dom/client'; const root = createRoot(document.getElementById('root')); root.render(<App />);`
npm ERR! ERESOLVE unable to resolve dependency tree ... Unmet peer dependency 'react'
`react-dom` requires `react` as a peer dependency, but it's either missing or installed at an incompatible version.
fix
Install `react` with a compatible version, e.g., `npm install react@^19.2.5` or `yarn add react@^19.2.5`.
Configuration for rule "react-hooks/component-hook-factories" is invalid
Your ESLint configuration references the `component-hook-factories` rule, but `eslint-plugin-react-hooks@7.1.0` temporarily removed it.
fix
Upgrade `eslint-plugin-react-hooks` to version `7.1.1` or later: `npm install eslint-plugin-react-hooks@latest`.
Upgrade
Version history
19.2.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
react-dom — npm install react-dom · libregistry