;
}
-ReactDOM.render(, node);
+const root = createRoot(document.getElementById('root'));
+root.render();
```
### On the server
```js
-var React = require('react');
-var ReactDOMServer = require('react-dom/server');
+import { renderToPipeableStream } from 'react-dom/server';
-function MyComponent() {
+function App() {
return
Hello World
;
}
-ReactDOMServer.renderToString();
+function handleRequest(res) {
+ // ... in your server handler ...
+ const stream = renderToPipeableStream(, {
+ onShellReady() {
+ res.statusCode = 200;
+ res.setHeader('Content-type', 'text/html');
+ stream.pipe(res);
+ },
+ // ...
+ });
+}
```
## API
### `react-dom`
-- `findDOMNode`
-- `render`
-- `unmountComponentAtNode`
+See https://reactjs.org/docs/react-dom.html
+
+### `react-dom/client`
+
+See https://reactjs.org/docs/react-dom-client.html
### `react-dom/server`
-- `renderToString`
-- `renderToStaticMarkup`
+See https://reactjs.org/docs/react-dom-server.html
diff --git a/packages/react/README.md b/packages/react/README.md
index 0033e23bd88..493f9c83395 100644
--- a/packages/react/README.md
+++ b/packages/react/README.md
@@ -6,8 +6,32 @@ The `react` package contains only the functionality necessary to define React co
**Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application.
-## Example Usage
+## Usage
```js
-var React = require('react');
+import { useState } from 'react';
+import { createRoot } from 'react-dom';
+
+function Counter() {
+ const [count, setCount] = useState(0);
+ return (
+ <>
+
{count}
+
+ >
+ );
+}
+
+const root = createRoot(document.getElementById('root'));
+root.render();
```
+
+## Documentation
+
+See https://reactjs.org/
+
+## API
+
+See https://reactjs.org/docs/react-api.html
diff --git a/packages/use-sync-external-store/README.md b/packages/use-sync-external-store/README.md
index c799272a93e..e9987a399b6 100644
--- a/packages/use-sync-external-store/README.md
+++ b/packages/use-sync-external-store/README.md
@@ -1,5 +1,5 @@
# use-sync-external-store
-Backwards compatible shim for React's `useSyncExternalStore`. Works with any React that supports hooks.
+Backwards-compatible shim for [`React.useSyncExternalStore`](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore). Works with any React that supports Hooks.
-Until `useSyncExternalStore` is documented, refer to https://github.com/reactwg/react-18/discussions/86
+See also https://github.com/reactwg/react-18/discussions/86.