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
muslnode 18–226 runs
build_error
glibcnode 18–226 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.fixMigrate 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.fixInstall `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`.fixUpgrade `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.
fixReplace `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.
fixInstall `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.
fixUpgrade `eslint-plugin-react-hooks` to version `7.1.1` or later: `npm install eslint-plugin-react-hooks@latest`.
Audit
Dependencies
No dependency data recorded yet.