react/packages/react-dom
Sebastian Markbåge 488d88b018
Some checks failed
(Compiler) Playground / Test playground (push) Has been cancelled
(Compiler) TypeScript / Discover yarn workspaces (push) Has been cancelled
(Compiler) TypeScript / Lint babel-plugin-react-compiler (push) Has been cancelled
(Compiler) TypeScript / Jest babel-plugin-react-compiler (push) Has been cancelled
(Runtime) ESLint Plugin E2E / ESLint v${{ matrix.eslint_major }} (6) (push) Has been cancelled
(Runtime) ESLint Plugin E2E / ESLint v${{ matrix.eslint_major }} (7) (push) Has been cancelled
(Runtime) ESLint Plugin E2E / ESLint v${{ matrix.eslint_major }} (8) (push) Has been cancelled
(Runtime) ESLint Plugin E2E / ESLint v${{ matrix.eslint_major }} (9) (push) Has been cancelled
(Runtime) Fuzz tests / test_fuzz (push) Has been cancelled
(Shared) Lint / Run prettier (push) Has been cancelled
(Shared) Lint / Run eslint (push) Has been cancelled
(Shared) Lint / Check license (push) Has been cancelled
(Shared) Lint / Test print warnings (push) Has been cancelled
(Compiler) TypeScript / Test ${{ matrix.workspace_name }} (push) Has been cancelled
(Runtime) Publish Prereleases Nightly / Publish to Canary channel (push) Has been cancelled
(Compiler) Publish Prereleases Nightly / Publish to Experimental channel (push) Has been cancelled
(Runtime) Publish Prereleases Nightly / Publish to Experimental channel (push) Has been cancelled
Render children passed to "backwards" SuspenseList in reverse mount order (#35021)
Stacked on #35018.

This mounts the children of SuspenseList backwards. Meaning the first
child is mounted last in the DOM (and effect list). It's like calling
reverse() on the children.

This is meant to set us up for allowing AsyncIterable children where the
unknown number of children streams in at the end (which is the beginning
in a backwards SuspenseList). For consistency we do that with other
children too.

`unstable_legacy-backwards` still exists for the old mode but is meant
to be deprecated.

<img width="100" alt="image"
src="https://github.com/user-attachments/assets/5c2a95d7-34c4-4a4e-b602-3646a834d779"
/>
2025-10-31 13:33:23 -04:00
..
npm [react-dom] Include all Node.js APIs in Bun entrypoint for /server (#34193) 2025-10-27 23:06:45 +01:00
src Render children passed to "backwards" SuspenseList in reverse mount order (#35021) 2025-10-31 13:33:23 -04:00
client.js [react-dom] move all client code to react-dom/client (#28271) 2024-04-24 08:50:32 -07:00
index.js [react-dom] move all client code to react-dom/client (#28271) 2024-04-24 08:50:32 -07:00
package.json Bump next prerelease version numbers (#34674) 2025-10-02 00:31:55 +02:00
profiling.js [react-dom] move all client code to react-dom/client (#28271) 2024-04-24 08:50:32 -07:00
README.md chore: update new docs links for react-dom (#26456) 2023-03-22 12:55:06 +01:00
server.browser.js Remove renderToStaticNodeStream (#28873) 2024-04-18 21:06:04 -07:00
server.bun.js [react-dom] Include all Node.js APIs in Bun entrypoint for /server (#34193) 2025-10-27 23:06:45 +01:00
server.edge.js Remove renderToStaticNodeStream (#28873) 2024-04-18 21:06:04 -07:00
server.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
server.node.js [Fizz] Add Web Streams to Fizz Node entry point (#33475) 2025-06-06 20:16:43 -04:00
static.browser.js [Fizz] Add resumeAndPrerender to Static Rendering (#30950) 2024-09-12 10:51:01 -04:00
static.edge.js [Fizz] Add resumeAndPrerender to Static Rendering (#30950) 2024-09-12 10:51:01 -04:00
static.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
static.node.js Match react-dom/static test entrypoints and published entrypoints (#34599) 2025-09-28 13:26:31 +02:00
test-utils.js [Codemod] Update copyright header to Meta (#25315) 2022-10-18 11:19:24 -04:00
unstable_server-external-runtime.js [ServerRenderer] Move fizz external runtime implementation to react-dom-bindings (#25617) 2022-11-03 11:15:29 -04:00
unstable_testing.experimental.js [react-dom] move all client code to react-dom/client (#28271) 2024-04-24 08:50:32 -07:00
unstable_testing.js [react-dom] move all client code to react-dom/client (#28271) 2024-04-24 08:50:32 -07:00

react-dom

This package serves as the entry point to the DOM and server renderers for React. It is intended to be paired with the generic React package, which is shipped as react to npm.

Installation

npm install react react-dom

Usage

In the browser

import { createRoot } from 'react-dom/client';

function App() {
  return <div>Hello World</div>;
}

const root = createRoot(document.getElementById('root'));
root.render(<App />);

On the server

import { renderToPipeableStream } from 'react-dom/server';

function App() {
  return <div>Hello World</div>;
}

function handleRequest(res) {
  // ... in your server handler ...
  const stream = renderToPipeableStream(<App />, {
    onShellReady() {
      res.statusCode = 200;
      res.setHeader('Content-type', 'text/html');
      stream.pipe(res);
    },
    // ...
  });
}

API

react-dom

See https://react.dev/reference/react-dom

react-dom/client

See https://react.dev/reference/react-dom/client

react-dom/server

See https://react.dev/reference/react-dom/server