Skip to content

Commit b9064d0

Browse files
authored
fix conflict
1 parent 84a0cda commit b9064d0

File tree

7 files changed

+19
-55
lines changed

7 files changed

+19
-55
lines changed

src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11469,7 +11469,7 @@ root.render(
1146911469

1147011470
**`<Activity />` 现在可以在 React Canary 版本使用。**
1147111471

11472-
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
11472+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
1147311473

1147411474
</Note>
1147511475

@@ -14303,11 +14303,7 @@ useEffect(() => {
1430314303
}); // 编译器插入的依赖项。
1430414304
```
1430514305

14306-
<<<<<<< HEAD
14307-
使用这段代码,React 编译器可以为你推断依赖项并自动插入它们,这样你就不需要看到或编写它们。通过像[IDE 扩展](#compiler-ide-extension)[`useEffectEvent`](/reference/react/experimental_useEffectEvent)这样的功能,我们可以提供一个 CodeLens 来显示编译器在你需要调试时插入的内容,或通过移除依赖项来优化。这有助于强化编写 Effects 的正确心智模型,即 Effects 可以在任何时候运行,以将你的组件或 hook 的状态与其他内容同步。
14308-
=======
14309-
With this code, the React Compiler can infer the dependencies for you and insert them automatically so you don't need to see or write them. With features like [the IDE extension](#compiler-ide-extension) and [`useEffectEvent`](/reference/react/useEffectEvent), we can provide a CodeLens to show you what the Compiler inserted for times you need to debug, or to optimize by removing a dependency. This helps reinforce the correct mental model for writing Effects, which can run at any time to synchronize your component or hook's state with something else.
14310-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
14306+
使用这段代码,React 编译器可以为你推断依赖项并自动插入它们,这样你就不需要看到或编写它们。通过像[IDE 扩展](#compiler-ide-extension)[`useEffectEvent`](/reference/react/useEffectEvent)这样的功能,我们可以提供一个 CodeLens 来显示编译器在你需要调试时插入的内容,或通过移除依赖项来优化。这有助于强化编写 Effects 的正确心智模型,即 Effects 可以在任何时候运行,以将你的组件或 hook 的状态与其他内容同步。
1431114307

1431214308
我们希望自动插入依赖项不仅更容易编写,而且通过迫使你从 Effect 的作用角度思考,而不是从组件生命周期角度思考,使它们更容易理解。
1431314309

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,9 @@ function ChatRoom({ roomId }) {
612612
613613
<Canary>
614614
615-
<<<<<<< HEAD
616-
本节描述了一个在稳定版本的 React 中 **尚未发布的实验性** API。
617-
=======
618-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
619-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
615+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
620616
621-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
617+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
622618
623619
</Canary>
624620

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,13 +839,9 @@ export default function ChatRoom({ roomId }) {
839839
840840
<Canary>
841841
842-
<<<<<<< HEAD
843-
这个章节描述了 React 稳定版 **还未发布的一个实验性 API**。
844-
=======
845-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
846-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
842+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
847843
848-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
844+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
849845
850846
</Canary>
851847

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

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -402,21 +402,13 @@ label { display: block; margin-top: 10px; }
402402
403403
<Canary>
404404
405-
<<<<<<< HEAD
406-
本章节描述了一个在 React 稳定版中 **还没有发布的实验性 API**。
407-
=======
408-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
409-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
405+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
410406
411-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
407+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
412408
413-
<<<<<<< HEAD
414-
使用 [`useEffectEvent`](/reference/react/experimental_useEffectEvent) 这个特殊的 Hook 从 Effect 中提取非响应式逻辑:
415-
=======
416409
</Canary>
417410
418-
Use a special Hook called [`useEffectEvent`](/reference/react/useEffectEvent) to extract this non-reactive logic out of your Effect:
419-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
411+
使用 [`useEffectEvent`](/reference/react/useEffectEvent) 这个特殊的 Hook 从 Effect 中提取非响应式逻辑:
420412
421413
```js {1,4-6}
422414
import { useEffect, useEffectEvent } from 'react';
@@ -590,13 +582,9 @@ label { display: block; margin-top: 10px; }
590582
591583
<Canary>
592584
593-
<<<<<<< HEAD
594-
本章节描述了一个在 React 稳定版中 **还没有发布的实验性 API**。
595-
=======
596-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
597-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
585+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
598586
599-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
587+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
600588
601589
</Canary>
602590
@@ -896,13 +884,9 @@ body {
896884
897885
<Canary>
898886
899-
<<<<<<< HEAD
900-
本章节描述了一个在 React 稳定版中 **还没有发布的实验性 API**。
901-
=======
902-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
903-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
887+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
904888
905-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
889+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
906890
907891
</Canary>
908892

src/content/reference/react/Activity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: canary
77

88
**The `<Activity />` API is currently only available in React’s Canary and Experimental channels.**
99

10-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
10+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
1111

1212
</Canary>
1313

src/content/reference/react/useEffect.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,13 +1693,9 @@ button { margin-left: 10px; }
16931693
16941694
<Canary>
16951695
1696-
<<<<<<< HEAD
1697-
本节描述了一个 **实验性的 API**,它还没有在一个稳定的 React 版本中发布。
1698-
=======
1699-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
1700-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
1696+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**。
17011697
1702-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
1698+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
17031699
17041700
</Canary>
17051701
@@ -1716,11 +1712,7 @@ function Page({ url, shoppingCart }) {
17161712
}
17171713
```
17181714
1719-
<<<<<<< HEAD
1720-
**如果你想在每次 `url` 更改后记录一次新的页面访问,而不是在 `shoppingCart` 更改后记录,该怎么办**?你不能在不违反 [响应规则](#specifying-reactive-dependencies) 的情况下将 `shoppingCart` 从依赖项中移除。然而,你可以表达你 **不希望** 某些代码对更改做出“响应”,即使它是在 Effect 内部调用的。使用 [`useEffectEvent`](/reference/react/experimental_useEffectEvent) Hook [声明 **Effect 事件**](/learn/separating-events-from-effects#declaring-an-effect-event),并将读取 `shoppingCart` 的代码移入其中:
1721-
=======
1722-
<CanaryBadge /> **What if you want to log a new page visit after every `url` change, but *not* if only the `shoppingCart` changes?** You can't exclude `shoppingCart` from dependencies without breaking the [reactivity rules.](#specifying-reactive-dependencies) However, you can express that you *don't want* a piece of code to "react" to changes even though it is called from inside an Effect. [Declare an *Effect Event*](/learn/separating-events-from-effects#declaring-an-effect-event) with the [`useEffectEvent`](/reference/react/useEffectEvent) Hook, and move the code reading `shoppingCart` inside of it:
1723-
>>>>>>> 49c2d26722fb1b5865ce0221a4cadc71b615e4cf
1715+
**如果你想在每次 `url` 更改后记录一次新的页面访问,而不是在 `shoppingCart` 更改后记录,该怎么办**?你不能在不违反 [响应规则](#specifying-reactive-dependencies) 的情况下将 `shoppingCart` 从依赖项中移除。然而,你可以表达你 **不希望** 某些代码对更改做出“响应”,即使它是在 Effect 内部调用的。使用 [`useEffectEvent`](/reference/react/useEffectEvent) Hook [声明 **Effect 事件**](/learn/separating-events-from-effects#declaring-an-effect-event),并将读取 `shoppingCart` 的代码移入其中:
17241716
17251717
```js {2-4,7,8}
17261718
function Page({ url, shoppingCart }) {

src/content/reference/react/useEffectEvent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ version: canary
66

77
<Canary>
88

9-
**The `useEffectEvent` API is currently only available in React’s Canary and Experimental channels.**
9+
**`useEffectEvent` API 当前仅在 React Canary 和 实验发行版中可用**
1010

11-
[Learn more about React’s release channels here.](/community/versioning-policy#all-release-channels)
11+
[了解更多关于 React 版本发布的内容](/community/versioning-policy#all-release-channels)
1212

1313
</Canary>
1414

0 commit comments

Comments
 (0)