白秋色的咸鱼 8785e1acea no message il y a 1 mois
..
cjs 8785e1acea no message il y a 1 mois
LICENSE 8785e1acea no message il y a 1 mois
README.md 8785e1acea no message il y a 1 mois
client.js 8785e1acea no message il y a 1 mois
client.react-server.js 8785e1acea no message il y a 1 mois
index.js 8785e1acea no message il y a 1 mois
package.json 8785e1acea no message il y a 1 mois
profiling.js 8785e1acea no message il y a 1 mois
profiling.react-server.js 8785e1acea no message il y a 1 mois
react-dom.react-server.js 8785e1acea no message il y a 1 mois
server.browser.js 8785e1acea no message il y a 1 mois
server.bun.js 8785e1acea no message il y a 1 mois
server.edge.js 8785e1acea no message il y a 1 mois
server.js 8785e1acea no message il y a 1 mois
server.node.js 8785e1acea no message il y a 1 mois
server.react-server.js 8785e1acea no message il y a 1 mois
static.browser.js 8785e1acea no message il y a 1 mois
static.edge.js 8785e1acea no message il y a 1 mois
static.js 8785e1acea no message il y a 1 mois
static.node.js 8785e1acea no message il y a 1 mois
static.react-server.js 8785e1acea no message il y a 1 mois
test-utils.js 8785e1acea no message il y a 1 mois

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