4b877b6c66
…affiliates. ## Summary There were 8 different places where the copyright comment was wrong. Rewrote from "Copyright (c) Facebook, Inc. and its affiliates." to "Copyright (c) Meta Platforms, Inc. and its affiliates." ## How did you test this change? No code was changed. Comment was still a comment after changes. Co-authored-by: Dennis Moradkhani <denmo530@student.liu.se> |
||
---|---|---|
.. | ||
npm | ||
src | ||
README.md | ||
client.js | ||
index.classic.fb.js | ||
index.experimental.js | ||
index.js | ||
index.modern.fb.js | ||
index.stable.js | ||
package.json | ||
server-rendering-stub.js | ||
server.browser.js | ||
server.bun.js | ||
server.edge.js | ||
server.js | ||
server.node.js | ||
static.browser.js | ||
static.edge.js | ||
static.js | ||
static.node.js | ||
test-utils.js | ||
unstable_server-external-runtime.js | ||
unstable_testing.classic.fb.js | ||
unstable_testing.experimental.js | ||
unstable_testing.js | ||
unstable_testing.modern.fb.js | ||
unstable_testing.stable.js |
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