Skip to content

Commit 565e3c4

Browse files
authored
docs: Add some translate in /reference/react-compiler (#1849)
2 parents eb8ce8b + 7a01375 commit 565e3c4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/content/reference/react-compiler/gating.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ title: gating
2121

2222
---
2323

24-
## Reference {/*reference*/}
24+
## 参考 {/*reference*/}
2525

2626
### `gating` {/*gating*/}
2727

2828
为已编译函数配置运行时特性开关的 gating。
2929

30-
#### Type {/*type*/}
30+
#### 类型 {/*type*/}
3131

3232
```
3333
{
@@ -62,7 +62,7 @@ title: gating
6262
```js
6363
// src/utils/feature-flags.js
6464
export function shouldUseCompiler() {
65-
// your logic here
65+
// 此处是你的逻辑
6666
return getFeatureFlag('react-compiler-enabled');
6767
}
6868
```
@@ -90,8 +90,8 @@ function Button(props) {
9090
import { shouldUseCompiler } from './src/utils/feature-flags';
9191

9292
const Button = shouldUseCompiler()
93-
? function Button_optimized(props) { /* compiled version */ }
94-
: function Button_original(props) { /* original version */ };
93+
? function Button_optimized(props) { /* 编译后的版本 */ }
94+
: function Button_original(props) { /* 源版本 */ };
9595
```
9696

9797
注意,gating 函数在模块加载时只会执行一次,因此一旦 JS 包被解析并执行,组件的选择将在本次浏览器会话的剩余时间内保持不变。

src/content/reference/react-compiler/target.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ npm install react-compiler-runtime@latest
8181
2. 配置 target:
8282

8383
```js
84-
// For React 18
84+
// 对于 React 18
8585
{
8686
target: '18'
8787
}
8888

89-
// For React 17
89+
// 对于 React 17
9090
{
9191
target: '17'
9292
}

0 commit comments

Comments
 (0)