Skip to content

Commit e396a61

Browse files
committed
docs(en): merging all conflicts
2 parents 278f926 + f15830d commit e396a61

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

src/content/learn/removing-effect-dependencies.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,11 @@ export default function Timer() {
12401240
12411241
</Sandpack>
12421242
1243+
<<<<<<< HEAD
12431244
你不应在 Effect 中读取 `count`,而是将 `c => c + 1` 指令(“增加此数字!”)传递给 React。React 将在下一次渲染时执行它。由于你不再需要读取 Effect 中 `count` 的值,因此你可以将 Effect 的依赖保持为空(`[]`)。这可以防止 Effect 在每次执行时重新创建定时器 interval。
1245+
=======
1246+
Instead of reading `count` inside the Effect, you pass a `c => c + 1` instruction ("increment this number!") to React. React will apply it on the next render. And since you don't need to read the value of `count` inside your Effect anymore, you can keep your Effect's dependencies empty (`[]`). This prevents your Effect from re-creating the interval on every tick.
1247+
>>>>>>> f15830d5a1eec60d474a57e700f3acba5eb65659
12441248
12451249
</Solution>
12461250

src/content/learn/reusing-logic-with-custom-hooks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,11 @@ export default function ChatRoom({ roomId }) {
820820
// ...
821821
```
822822
823+
<<<<<<< HEAD
823824
并把它作为输入传给另一个 Hook:
825+
=======
826+
and passing it as an input to another Hook:
827+
>>>>>>> f15830d5a1eec60d474a57e700f3acba5eb65659
824828
825829
```js {6}
826830
export default function ChatRoom({ roomId }) {

src/content/learn/separating-events-from-effects.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,23 @@ Effect Event 是 Effect 代码的非响应式“片段”。他们应该在使
973973
974974
<Sandpack>
975975
976+
```json package.json hidden
977+
{
978+
"dependencies": {
979+
"react": "experimental",
980+
"react-dom": "experimental",
981+
"react-scripts": "latest"
982+
},
983+
"scripts": {
984+
"start": "react-scripts start",
985+
"build": "react-scripts build",
986+
"test": "react-scripts test --env=jsdom",
987+
"eject": "react-scripts eject"
988+
}
989+
}
990+
```
991+
992+
976993
```js
977994
import { useState, useEffect } from 'react';
978995

@@ -1026,6 +1043,22 @@ button { margin: 10px; }
10261043
10271044
<Sandpack>
10281045
1046+
```json package.json hidden
1047+
{
1048+
"dependencies": {
1049+
"react": "experimental",
1050+
"react-dom": "experimental",
1051+
"react-scripts": "latest"
1052+
},
1053+
"scripts": {
1054+
"start": "react-scripts start",
1055+
"build": "react-scripts build",
1056+
"test": "react-scripts test --env=jsdom",
1057+
"eject": "react-scripts eject"
1058+
}
1059+
}
1060+
```
1061+
10291062
```js
10301063
import { useState, useEffect } from 'react';
10311064

src/content/reference/react-dom/preinit.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function AppRoot() {
4444

4545
#### 参数 {/*parameters*/}
4646

47+
<<<<<<< HEAD
4748
* `href`:字符串,要下载并执行的资源的 URL。
4849
* `options`:对象,可以包含以下属性:
4950
* `as`:必需的字符串,表示资源的类型,可能的值包括 `script``style`
@@ -52,6 +53,16 @@ function AppRoot() {
5253
* `integrity`:字符串,为资源的加密哈希,用于 [验证其真实性](https://developer.mozilla.org/zh-CN/docs/Web/Security/Subresource_Integrity)
5354
* `nonce`:字符串,表示使用严格内容安全策略时允许资源的 [加密随机数](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Global_attributes/nonce)
5455
* `fetchPriority`:字符串,表示建议获取资源的相对优先级,可能的值为 `auto`(默认值)、`high``low`
56+
=======
57+
* `href`: a string. The URL of the resource you want to download and execute.
58+
* `options`: an object. It contains the following properties:
59+
* `as`: a required string. The type of resource. Its possible values are `script` and `style`.
60+
* `precedence`: a string. Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are `reset`, `low`, `medium`, `high`.
61+
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
62+
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
63+
* `nonce`: a string. A cryptographic [nonce to allow the resource](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
64+
* `fetchPriority`: a string. Suggests a relative priority for fetching the resource. The possible values are `auto` (the default), `high`, and `low`.
65+
>>>>>>> f15830d5a1eec60d474a57e700f3acba5eb65659
5566
5667
#### 返回值 {/*returns*/}
5768

0 commit comments

Comments
 (0)