{"id":10411,"library":"react-dom","title":"React DOM","description":"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.","status":"active","version":"19.2.5","language":"javascript","source_language":"en","source_url":"https://github.com/facebook/react","tags":["javascript","react"],"install":[{"cmd":"npm install react-dom","lang":"bash","label":"npm"},{"cmd":"yarn add react-dom","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-dom","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"For React 18+ applications, use createRoot for initial rendering.","wrong":"import { render } from 'react-dom'","symbol":"createRoot","correct":"import { createRoot } from 'react-dom/client'"},{"note":"For hydrating server-rendered React applications (React 18+).","symbol":"hydrateRoot","correct":"import { hydrateRoot } from 'react-dom/client'"},{"note":"Primarily for legacy APIs like ReactDOM.render or when accessing other ReactDOM methods not available via react-dom/client.","symbol":"ReactDOM","correct":"import ReactDOM from 'react-dom'"}],"quickstart":{"code":"import { createRoot } from 'react-dom/client';\nimport React from 'react';\n\nfunction App() {\n  return <h1>Hello, React 19!</h1>;\n}\n\nconst container = document.getElementById('root');\nif (container) {\n  const root = createRoot(container);\n  root.render(<App />);\n} else {\n  console.error('Root element not found in the DOM.');\n}","lang":"typescript","description":"Demonstrates how to render a basic React component into a DOM element using `createRoot`, the recommended method for React 18+ applications."},"warnings":[{"fix":"Migrate from `ReactDOM.render(<App />, container)` to `import { createRoot } from 'react-dom/client'; const root = createRoot(container); root.render(<App />);`","message":"`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.","severity":"breaking","affected_versions":">=18.0.0"},{"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`.","message":"`react-dom` has a peer dependency on `react`. Ensure you have `react` installed at a compatible version to avoid installation issues or runtime errors.","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade `eslint-plugin-react-hooks` to `7.1.1` or later: `npm install eslint-plugin-react-hooks@latest`.","message":"`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`.","severity":"gotcha","affected_versions":"eslint-plugin-react-hooks@7.1.0"}],"env_vars":null,"last_verified":"2026-04-18T00:00:00.000Z","next_check":"2026-07-17T00:00:00.000Z","problems":[{"fix":"Replace `ReactDOM.render(<App />, document.getElementById('root'));` with: `import { createRoot } from 'react-dom/client'; const root = createRoot(document.getElementById('root')); root.render(<App />);`","cause":"Attempting to use the legacy `ReactDOM.render` API in a React 18+ application.","error":"Error: ReactDOM.render is no longer supported in React 18. Use createRoot instead."},{"fix":"Install `react` with a compatible version, e.g., `npm install react@^19.2.5` or `yarn add react@^19.2.5`.","cause":"`react-dom` requires `react` as a peer dependency, but it's either missing or installed at an incompatible version.","error":"npm ERR! ERESOLVE unable to resolve dependency tree ... Unmet peer dependency 'react'"},{"fix":"Upgrade `eslint-plugin-react-hooks` to version `7.1.1` or later: `npm install eslint-plugin-react-hooks@latest`.","cause":"Your ESLint configuration references the `component-hook-factories` rule, but `eslint-plugin-react-hooks@7.1.0` temporarily removed it.","error":"Configuration for rule \"react-hooks/component-hook-factories\" is invalid"}],"ecosystem":"npm"}