comparison third_party/bun/node_modules/react-dom/README.md @ 12:de54585a40f1

Adding bun and node modules.
author June Park <parkjune1995@gmail.com>
date Thu, 02 Oct 2025 14:39:48 -0700
parents
children
comparison
equal deleted inserted replaced
11:f33d9ff8b6e8 12:de54585a40f1
1 # `react-dom`
2
3 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.
4
5 ## Installation
6
7 ```sh
8 npm install react react-dom
9 ```
10
11 ## Usage
12
13 ### In the browser
14
15 ```js
16 import { createRoot } from 'react-dom/client';
17
18 function App() {
19 return <div>Hello World</div>;
20 }
21
22 const root = createRoot(document.getElementById('root'));
23 root.render(<App />);
24 ```
25
26 ### On the server
27
28 ```js
29 import { renderToPipeableStream } from 'react-dom/server';
30
31 function App() {
32 return <div>Hello World</div>;
33 }
34
35 function handleRequest(res) {
36 // ... in your server handler ...
37 const stream = renderToPipeableStream(<App />, {
38 onShellReady() {
39 res.statusCode = 200;
40 res.setHeader('Content-type', 'text/html');
41 stream.pipe(res);
42 },
43 // ...
44 });
45 }
46 ```
47
48 ## API
49
50 ### `react-dom`
51
52 See https://reactjs.org/docs/react-dom.html
53
54 ### `react-dom/client`
55
56 See https://reactjs.org/docs/react-dom-client.html
57
58 ### `react-dom/server`
59
60 See https://reactjs.org/docs/react-dom-server.html