Browse Source

Fix typo

main
dan 2 years ago
committed by GitHub
parent
commit
98bb99e397
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      beta/src/content/apis/react-dom/server/renderToReadableStream.md

4
beta/src/content/apis/react-dom/server/renderToReadableStream.md

@ -135,7 +135,7 @@ const assetMap = {
async function handler(request) { async function handler(request) {
const stream = await renderToReadableStream(<App assetMap={assetMap} />, { const stream = await renderToReadableStream(<App assetMap={assetMap} />, {
// Careful: It's safe to stringify() this because this data isn't user-generated. // Careful: It's safe to stringify() this because this data isn't user-generated.
bootstrapScriptContents: `window.assetMap = ${JSON.stringify(assetMap)};`, bootstrapScriptContent: `window.assetMap = ${JSON.stringify(assetMap)};`,
bootstrapScripts: [assets['/main.js']], bootstrapScripts: [assets['/main.js']],
}); });
return new Response(stream, { return new Response(stream, {
@ -144,7 +144,7 @@ async function handler(request) {
} }
``` ```
In the example above, the `bootstrapScriptContents` option adds an extra inline `<script>` tag that sets the global `window.assetMap` variable on the client. This lets the client code read the same `assetMap`: In the example above, the `bootstrapScriptContent` option adds an extra inline `<script>` tag that sets the global `window.assetMap` variable on the client. This lets the client code read the same `assetMap`:
```js {4} ```js {4}
import {hydrateRoot} from 'react-dom/client'; import {hydrateRoot} from 'react-dom/client';

Loading…
Cancel
Save