ostp/ostp-license/frontend/node_modules/react-dom
ospab 1568db3323 ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
..
cjs ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
LICENSE ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
README.md ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
client.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
client.react-server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
index.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
package.json ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
profiling.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
profiling.react-server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
react-dom.react-server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.browser.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.bun.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.edge.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.node.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
server.react-server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
static.browser.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
static.edge.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
static.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
static.node.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
static.react-server.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00
test-utils.js ci: rename nightly to alpha 2026-07-09 02:46:47 +03:00

README.md

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