-
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
[Beta] docs(cn): translate reference/render.md #632
Conversation
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.com>
Co-authored-by: QiChang Li <github@liqichang.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.
发现了一些错误,麻烦看一下 @QC-L
--- | ||
|
||
<Intro> | ||
|
||
`render` renders a piece of [JSX](/learn/writing-markup-with-jsx) ("React element") into a browser DOM container node. It instructs React to change the DOM inside of the `container` so that it matches the passed JSX. | ||
`render` 函数会将 [JSX](/learn/writing-markup-with-jsx)(“React 元素”)渲染到浏览器 DOM 容器节点中。它可以让 React 改变 `container` 中 DOM,使其与传递的 JSX 相匹配。 |
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.
修改建议:
- ”它可以让 React 改变
container
中的 DOM“ - ”所传递的 JSX“
|
||
</AnatomyStep> | ||
|
||
<AnatomyStep title="DOM container"> | ||
|
||
The DOM node you want to render your UI into. The container itself isn’t modified, only its children are. | ||
用于渲染 UI 界面的 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.
这句明显错了,应该是"该容器本身不会被修改"、”只有其子节点会被修改“
@@ -38,7 +41,7 @@ render(<App />, container); | |||
|
|||
</APIAnatomy> | |||
|
|||
In apps fully built with React, you will do this once at the top level of your app--to render the "root" component. | |||
在完全由 React 构建的应用程序中,你需要在你的应用程序的入口文件执行该操作(渲染 "root" 组件)。 |
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.
”在完全 使用 React 构建的应用程序中,你需要在你应用程序的最顶层执行一次该操作——渲染 "根" 组件。“
- with 应该翻译成使用
- 入口文件 entry file 是 webpack 中的概念,不应该用在这里,因为不是所有 react 应用都是用 webpack 写的,建议按原文直译
<Comment text="Hello!" author="Sophie" /> | ||
<Comment text="How are you?" author="Sunil" /> | ||
<Comment text="你好!" author="Sophie" /> | ||
<Comment text="你是谁?" author="Sunil" /> |
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.
你好吗?
How are you 不是 who are you
|
||
<br /> | ||
|
||
|
||
## Behavior in detail {/*behavior-in-detail*/} | ||
## 行为细节 {/*behavior-in-detail*/} |
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.
behavior 除了可以指行为,还可以指特性,这里译为特性更合适
@@ -134,9 +137,9 @@ nav ul li { display: inline-block; margin-right: 20px; } | |||
|
|||
<br /> | |||
|
|||
## Updating the rendered tree {/*updating-the-rendered-tree*/} | |||
## 更新已渲染的 DOM {/*updating-the-rendered-tree*/} |
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.
建议改成 更新已渲染的树 或 更新已渲染的组件树,因为组件树是 React 中的,DOM 树是浏览器中的,两者不能混淆,而且下文中有对两者关系的叙述,应该区别清楚,避免增加理解难度
|
||
The first time you call `render`, any existing DOM elements inside `container` are replaced. If you call `render` again, React will update the DOM as necessary to reflect the latest JSX. React will decide which parts of the DOM can be reused and which need to be recreated by ["matching it up"](/learn/preserving-and-resetting-state) with the previously rendered tree. Calling `render` repeatedly is similar to calling `setState`--in both cases, React avoids unnecessary DOM updates. | ||
在你第一次调用 `render` 时,`container` 内的任何已有 DOM 元素都会被替换。如果你再次调用 `render` 时,React 将会通过与先前渲染的组件树 ["匹配"](/learn/preserving-and-resetting-state) 的方式,来决定 DOM 的哪些部分可以重用,哪些需要重新创建。重复调用 `render` 与调用 `setState` 效果类似。无论哪种情况,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.
如果你再次调用 render
的话,React 会为了体现最新的 JSX 而进行必要的 DOM 更新。React 会通过将 DOM 与先前渲染的组件树进行 "匹配" 的方式,来决定 DOM 的哪些部分可以重用,哪些需要重新创建。重复调用 render
与调用 setState
类似——在这两种情况下,React 都会避免不必要的 DOM 更新。
- 这里”React will update the DOM as necessary to reflect the latest JSX.“漏译了
- matching it up 中的 it 指的是 DOM,应该翻译出来
- 建议把”效果类似“中的”效果“去掉。不应该说两种调用的效果类似,因为本质上 render 是负责挂载组件的而 setState 是负责改变 state 的。只能说在避免不必要的 DOM 更新方面两者是类似的。
|
||
You can pass a callback as the third argument. React will call it after your component is in the DOM. | ||
你可以将一个回调函数,作为 `render` 的第三个参数。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.
你可以将一个回调函数作为第三个参数传递给 render
。React 会在你的组件在 DOM 中出现后调用它。
- pass 漏译了
- 谓语之前不要加逗号
@Neo42 你的建议非常中肯,但此 PR 已经merge了,非常建议你能拉取最新的分支,新建分支并做出修改建议后重新提交新的PR,以便问题被更好地 merge |
@KimYangOfCat 好的,我会尽快提交 |
@KimYangOfCat 已提交 pr #703 |
No description provided.