docs(cn): translate learn/removing-effect-dependencies into Chinese#1144
Conversation
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
6ccaced to
42254a3
Compare
42254a3 to
55e5559
Compare
Size changesDetails📦 Next.js Bundle Analysis for react-devThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
| ``` | ||
|
|
||
| [Effects "react" to reactive values.](/learn/lifecycle-of-reactive-effects#effects-react-to-reactive-values) Since `roomId` is a reactive value (it can change due to a re-render), the linter verifies that you've specified it as a dependency. If `roomId` receives a different value, React will re-synchronize your Effect. This ensures that the chat stays connected to the selected room and "reacts" to the dropdown: | ||
| [Effects “反应”响应式值](/learn/lifecycle-of-reactive-effects#effects-react-to-react-values) 因为这里的 `roomId` 是一个响应式值(它可能随重新渲染而改变),所以 linter 会验证你是否将它指定为一个依赖项。如果 `roomId` 变成不同的值,React 将重新运行你的 Effect。这可以确保聊天界面与所选房间保持一致,并把变化“反馈”给下拉菜单: |
There was a problem hiding this comment.
| [Effects “反应”响应式值](/learn/lifecycle-of-reactive-effects#effects-react-to-react-values) 因为这里的 `roomId` 是一个响应式值(它可能随重新渲染而改变),所以 linter 会验证你是否将它指定为一个依赖项。如果 `roomId` 变成不同的值,React 将重新运行你的 Effect。这可以确保聊天界面与所选房间保持一致,并把变化“反馈”给下拉菜单: | |
| [Effect “反应”响应式值](/learn/lifecycle-of-reactive-effects#effects-react-to-react-values) 因为这里的 `roomId` 是一个响应式值(它可能随重新渲染而改变),所以 linter 会验证你是否将它指定为一个依赖项。如果 `roomId` 变成不同的值,React 将重新运行你的 Effect。这可以确保聊天界面与所选房间保持一致,并把变化“反馈”给下拉菜单: |
There was a problem hiding this comment.
这里的意思是,Effects => Effect ?
|
注意到你删除了任务领取,你是否还想为这篇翻译作出贡献呢? |
|
@awxiaoxian2020 我没有删除任务领取,不知道是哪里出错了。我按照 @Yucohny 的要求重新检查,再提交一下。 |
|
目前的问题是有重复的 PR。 |
| - 当你对依赖项不满意时,你需要编辑的是代码。 | ||
| - 抑制 linter 会导致非常混乱的错误,你应该始终避免它。 | ||
| - 要移除依赖项,你需要向 linter “证明”它不是必需的。 | ||
| - 如果某些代码是响应特定交互,请将该代码移至事件处理部分。 |
There was a problem hiding this comment.
改成 “如果某些代码是为了响应特定交互,请将该代码移至事件处理程序部分” 更通顺一些
There was a problem hiding this comment.
这里我改成:如果某些代码是为了响应特定交互,请将该代码移至事件处理的地方
请帮忙评估一下。
此提议很好,我觉得可以将其都统一为“依赖”,请评估。 |
546d7aa to
d1913b7
Compare
可以的。 |





@QC-L @Yucohny @awxiaoxian2020