mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-26 07:25:20 +00:00
fix: typo in docs on prerendering (#7823)
This commit is contained in:
@@ -68,7 +68,7 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
|
||||
|
||||
#### Caveats {/*caveats*/}
|
||||
|
||||
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the a nonce value in the prerender itself.
|
||||
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the nonce value in the prerender itself.
|
||||
|
||||
|
||||
<Note>
|
||||
@@ -231,7 +231,7 @@ async function renderToString() {
|
||||
const {prelude} = await prerender(<App />, {
|
||||
bootstrapScripts: ['/main.js']
|
||||
});
|
||||
|
||||
|
||||
const reader = prelude.getReader();
|
||||
let content = '';
|
||||
while (true) {
|
||||
@@ -317,7 +317,6 @@ Any Suspense boundaries with incomplete children will be included in the prelude
|
||||
|
||||
### My stream doesn't start until the entire app is rendered {/*my-stream-doesnt-start-until-the-entire-app-is-rendered*/}
|
||||
|
||||
The `prerender` response waits for the entire app to finish rendering, including waiting for all Suspense boundaries to resolve, before resolving. It is designed for static site generation (SSG) ahead of time and does not support streaming more content as it loads.
|
||||
The `prerender` response waits for the entire app to finish rendering, including waiting for all Suspense boundaries to resolve, before resolving. It is designed for static site generation (SSG) ahead of time and does not support streaming more content as it loads.
|
||||
|
||||
To stream content as it loads, use a streaming server render API like [renderToReadableStream](/reference/react-dom/server/renderToReadableStream).
|
||||
|
||||
@@ -69,7 +69,7 @@ On the client, call [`hydrateRoot`](/reference/react-dom/client/hydrateRoot) to
|
||||
|
||||
#### Caveats {/*caveats*/}
|
||||
|
||||
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the a nonce value in the prerender itself.
|
||||
`nonce` is not an available option when prerendering. Nonces must be unique per request and if you use nonces to secure your application with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP) it would be inappropriate and insecure to include the nonce value in the prerender itself.
|
||||
|
||||
<Note>
|
||||
|
||||
@@ -95,7 +95,7 @@ app.use('/', async (request, response) => {
|
||||
const { prelude } = await prerenderToNodeStream(<App />, {
|
||||
bootstrapScripts: ['/main.js'],
|
||||
});
|
||||
|
||||
|
||||
response.setHeader('Content-Type', 'text/plain');
|
||||
prelude.pipe(response);
|
||||
});
|
||||
@@ -232,7 +232,7 @@ async function renderToString() {
|
||||
const {prelude} = await prerenderToNodeStream(<App />, {
|
||||
bootstrapScripts: ['/main.js']
|
||||
});
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
let data = '';
|
||||
prelude.on('data', chunk => {
|
||||
@@ -320,4 +320,3 @@ Any Suspense boundaries with incomplete children will be included in the prelude
|
||||
The `prerenderToNodeStream` response waits for the entire app to finish rendering, including waiting for all Suspense boundaries to resolve, before resolving. It is designed for static site generation (SSG) ahead of time and does not support streaming more content as it loads.
|
||||
|
||||
To stream content as it loads, use a streaming server render API like [renderToPipeableStream](/reference/react-dom/server/renderToPipeableStream).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user