Skip to content

Commit 139cd16

Browse files
authored
docs: Add Chinese translations to prerenderToNodeStream.md comments (#1836)
2 parents 14b1531 + 67003a8 commit 139cd16

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/content/reference/react-dom/static/prerenderToNodeStream.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const {prelude} = await prerenderToNodeStream(reactNode, options?)
3131
```js
3232
import { prerenderToNodeStream } from 'react-dom/static';
3333

34-
// The route handler syntax depends on your backend framework
34+
// 路由处理的语法取决于后端框架
3535
app.use('/', async (request, response) => {
3636
const { prelude } = await prerenderToNodeStream(<App />, {
3737
bootstrapScripts: ['/main.js'],
@@ -90,7 +90,7 @@ app.use('/', async (request, response) => {
9090
```js [[1, 5, "<App />"], [2, 6, "['/main.js']"]]
9191
import { prerenderToNodeStream } from 'react-dom/static';
9292

93-
// The route handler syntax depends on your backend framework
93+
// 路由处理的语法取决于后端框架
9494
app.use('/', async (request, response) => {
9595
const { prelude } = await prerenderToNodeStream(<App />, {
9696
bootstrapScripts: ['/main.js'],
@@ -128,7 +128,7 @@ React 会将 [doctype](https://developer.mozilla.org/en-US/docs/Glossary/Doctype
128128
```html [[2, 5, "/main.js"]]
129129
<!DOCTYPE html>
130130
<html>
131-
<!-- ... HTML from your components ... -->
131+
<!-- ... 组件中的 HTML ... -->
132132
</html>
133133
<script src="/main.js" async=""></script>
134134
```
@@ -169,7 +169,7 @@ export default function App({ assetMap }) {
169169
在服务器端,渲染 `<App assetMap={assetMap} />` 并传入 `assetMap`
170170
171171
```js {1-5,8,9}
172-
// You'd need to get this JSON from your build tooling, e.g. read it from the build output.
172+
// 您需要从构建工具中获取 JSON。例如,从构建输出中阅读。
173173
const assetMap = {
174174
'styles.css': '/styles.123456.css',
175175
'main.js': '/main.123456.js'
@@ -188,7 +188,7 @@ app.use('/', async (request, response) => {
188188
因为现在服务器端是用 `assetMap` 渲染 `<App assetMap={assetMap} />`,客户端也需要以相同方式渲染以避免 hydration 错误。你可以像下面这样将 `assetMap` 序列化并传给客户端:
189189
190190
```js {9-10}
191-
// You'd need to get this JSON from your build tooling.
191+
// 您需要从构建工具中获取 JSON
192192
const assetMap = {
193193
'styles.css': '/styles.123456.css',
194194
'main.js': '/main.123456.js'
@@ -301,8 +301,8 @@ async function renderToString() {
301301
}, 10000);
302302

303303
try {
304-
// the prelude will contain all the HTML that was prerendered
305-
// before the controller aborted.
304+
// prelude 将包含预渲染的所有 HTML 代码
305+
// 在控制器终止之前。
306306
const {prelude} = await prerenderToNodeStream(<App />, {
307307
signal: controller.signal,
308308
});

0 commit comments

Comments
 (0)