-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(cn): translate content/docs/hooks-effect.md into Chinese #123
Conversation
Deploy preview for cn-reactjs ready! Built with commit effe0de |
content/docs/hooks-effect.md
Outdated
This snippet is based on the [counter example from the previous page](/docs/hooks-state.html), but we added a new feature to it: we set the document title to a custom message including the number of clicks. | ||
这段代码是基于[上一页中的计数器示例](/docs/hooks-state.html)修改的,我们为计数器增加了一个小功能:将 document 的 title 设置为一句包含了点击次数的消息 | ||
|
||
数据获取,设置订阅以及手动更改 React 组件中的 DOM 都是副作用的示例。无论你之前是否将他们称为"副作用"(可能就是你想要的效果),应该都在组件中使用过了。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or just "effects")
翻译错了,这是说 side effects 可以简称 effects。
其实括号里的内容可以不翻译直接去掉,因为中文里没有这样的简称。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
数据获取 -> 获取数据,跟后面的“设置订阅”等保持同样的 动宾短语 结构是不是比较好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里我觉得它的原意就是有些解释 side effect 的 side 的感觉。这一页主要讲的是 effect hook,effect 在这里是一个单独的概念,而 side effect 是一个容易理解为“副作用”的短语。所以这里解释一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉确实没必要翻译这个"just 'effects'",这里的确是说有时候这些副作用就是我们的目的,但是这里翻成“想要的效果”太奇怪了...
content/docs/hooks-effect.md
Outdated
|
||
This is because in many cases we want to perform the same side effect regardless of whether the component just mounted, or if it has been updated. Conceptually, we want it to happen after every render -- but React class components don't have a method like this. We could extract a separate method but we would still have to call it in two places. | ||
这是因为很多情况下我们希望在组件加载和更新时执行同样的操作。从概念上说,我们希望它在每次渲染之后执行 ———— 但 React 的类定义组件没有提供这样的方法。即使我们提取出一个方法,我们还是要在两个地方调用它。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
side effect
应该是副作用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class 组件。FYI: #2
Deploy preview for zh-hans-reactjs ready! Built with commit 698dfe2 |
Deploy preview for zh-hans-reactjs ready! Built with commit effe0de |
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢造福群众~
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
Co-Authored-By: Crazydogs <crazydogazrael@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
…s#123) * 翻译了 effect hook 的前半部分 * hooks-effect 翻译完成 * Update hooks-effect.md 修改一些问题 * Update hooks-effect.md * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update hooks-effect.md * Update hooks-effect.md * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update hooks-effect.md quota * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update hooks-effect.md * Update hooks-effect.md * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update hooks-effect.md * docs:modify hooks-effect doc * Update hooks-effect.md * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update content/docs/hooks-effect.md Co-Authored-By: Crazydogs <crazydogazrael@gmail.com> * Update hooks-effect.md * Update hooks-effect.md * Update hooks-effect.md * Update hooks-effect.md * Update hooks-effect.md * Update hooks-effect.md
content/docs/hooks-effect.md done.