Frontend/25_01_07/mai/node_modules/react-dom
szabomarton 7f4a15b9c3 asd
2025-01-28 11:38:27 +01:00
..
cjs asd 2025-01-28 11:38:27 +01:00
client.js asd 2025-01-28 11:38:27 +01:00
client.react-server.js asd 2025-01-28 11:38:27 +01:00
index.js asd 2025-01-28 11:38:27 +01:00
LICENSE asd 2025-01-28 11:38:27 +01:00
package.json asd 2025-01-28 11:38:27 +01:00
profiling.js asd 2025-01-28 11:38:27 +01:00
profiling.react-server.js asd 2025-01-28 11:38:27 +01:00
react-dom.react-server.js asd 2025-01-28 11:38:27 +01:00
README.md asd 2025-01-28 11:38:27 +01:00
server.browser.js asd 2025-01-28 11:38:27 +01:00
server.bun.js asd 2025-01-28 11:38:27 +01:00
server.edge.js asd 2025-01-28 11:38:27 +01:00
server.js asd 2025-01-28 11:38:27 +01:00
server.node.js asd 2025-01-28 11:38:27 +01:00
server.react-server.js asd 2025-01-28 11:38:27 +01:00
static.browser.js asd 2025-01-28 11:38:27 +01:00
static.edge.js asd 2025-01-28 11:38:27 +01:00
static.js asd 2025-01-28 11:38:27 +01:00
static.node.js asd 2025-01-28 11:38:27 +01:00
static.react-server.js asd 2025-01-28 11:38:27 +01:00
test-utils.js asd 2025-01-28 11:38:27 +01: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