Skip to content

Commit e595a47

Browse files
Merge branch 'main' of https://github.com/reactjs/react.dev into sync-af54fc87
2 parents d2607ff + af54fc8 commit e595a47

File tree

7 files changed

+43
-2
lines changed

7 files changed

+43
-2
lines changed

src/content/learn/start-a-new-react-project.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ If you want to build a new app or a new website fully with React, we recommend p
2424
npx create-next-app@latest
2525
</TerminalBlock>
2626

27-
If you're new to Next.js, check out the [Next.js tutorial.](https://nextjs.org/learn/foundations/about-nextjs)
27+
If you're new to Next.js, check out the [learn Next.js course.](https://nextjs.org/learn)
2828

2929
Next.js is maintained by [Vercel](https://vercel.com/). You can [deploy a Next.js app](https://nextjs.org/docs/app/building-your-application/deploying) to any Node.js or serverless hosting, or to your own server. Next.js also supports a [static export](https://nextjs.org/docs/pages/building-your-application/deploying/static-exports) which doesn't require a server.
3030

src/content/reference/react-dom/server/renderToNodeStream.md

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
4343

4444
* `reactNode`: A React node you want to render to HTML. For example, a JSX element like `<App />`.
4545

46+
* **optional** `options`: An object for server render.
47+
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page. Must be the same prefix as passed to [`hydrateRoot`.](/reference/react-dom/client/hydrateRoot#parameters)
48+
4649
#### Returns {/*returns*/}
4750

4851
A [Node.js Readable Stream](https://nodejs.org/api/stream.html#readable-streams) that outputs an HTML string.

src/content/reference/react-dom/server/renderToStaticMarkup.md

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ It will produce non-interactive HTML output of your React components.
3535
#### Parameters {/*parameters*/}
3636

3737
* `reactNode`: A React node you want to render to HTML. For example, a JSX node like `<Page />`.
38+
* **optional** `options`: An object for server render.
39+
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
3840

3941
#### Returns {/*returns*/}
4042

src/content/reference/react-dom/server/renderToStaticNodeStream.md

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ The stream will produce non-interactive HTML output of your React components.
3737

3838
* `reactNode`: A React node you want to render to HTML. For example, a JSX element like `<Page />`.
3939

40+
* **optional** `options`: An object for server render.
41+
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page.
42+
4043
#### Returns {/*returns*/}
4144

4245
A [Node.js Readable Stream](https://nodejs.org/api/stream.html#readable-streams) that outputs an HTML string. The resulting HTML can't be hydrated on the client.

src/content/reference/react-dom/server/renderToString.md

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
4242

4343
* `reactNode`: A React node you want to render to HTML. For example, a JSX node like `<App />`.
4444

45+
* **optional** `options`: An object for server render.
46+
* **optional** `identifierPrefix`: A string prefix React uses for IDs generated by [`useId`.](/reference/react/useId) Useful to avoid conflicts when using multiple roots on the same page. Must be the same prefix as passed to [`hydrateRoot`.](/reference/react-dom/client/hydrateRoot#parameters)
47+
4548
#### Returns {/*returns*/}
4649

4750
An HTML string.

src/content/reference/react/StrictMode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Strict Mode enables the following checks in development:
9595

9696
---
9797

98-
### Enabling strict mode for a part of the app {/*enabling-strict-mode-for-a-part-of-the-app*/}
98+
### Enabling Strict Mode for a part of the app {/*enabling-strict-mode-for-a-part-of-the-app*/}
9999

100100
You can also enable Strict Mode for any part of your application:
101101

src/content/reference/react/useId.md

+30
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,33 @@ input { margin: 5px; }
302302
```
303303
304304
</Sandpack>
305+
306+
---
307+
308+
### Using the same ID prefix on the client and the server {/*using-the-same-id-prefix-on-the-client-and-the-server*/}
309+
310+
If you [render multiple independent React apps on the same page](#specifying-a-shared-prefix-for-all-generated-ids), and some of these apps are server-rendered, make sure that the `identifierPrefix` you pass to the [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) call on the client side is the same as the `identifierPrefix` you pass to the [server APIs](/reference/react-dom/server) such as [`renderToPipeableStream`.](/reference/react-dom/server/renderToPipeableStream)
311+
312+
```js
313+
// Server
314+
import { renderToPipeableStream } from 'react-dom/server';
315+
316+
const { pipe } = renderToPipeableStream(
317+
<App />,
318+
{ identifierPrefix: 'react-app1' }
319+
);
320+
```
321+
322+
```js
323+
// Client
324+
import { hydrateRoot } from 'react-dom/client';
325+
326+
const domNode = document.getElementById('root');
327+
const root = hydrateRoot(
328+
domNode,
329+
reactNode,
330+
{ identifierPrefix: 'react-app1' }
331+
);
332+
```
333+
334+
You do not need to pass `identifierPrefix` if you only have one React app on the page.

0 commit comments

Comments
 (0)