Skip to content

Commit 4f9653c

Browse files
Apply suggestions from code review
1 parent 88528fc commit 4f9653c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/content/reference/react/useRef.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,16 @@ function MyComponent() {
228228
229229
如果 *不得不* 在渲染期间读取[或者写入](/reference/react/useState#storing-information-from-previous-renders),[使用 state](/reference/react/useState) 代替。
230230
231-
当你打破这些规则时,你的组件可能仍然可以工作,但我们添加到 React 的大多数新功能将依赖于这些预期行为。阅读更多关于[保持你的组件纯粹。](/learn/keeping-components-pure#where-you-can-cause-side-effects)
231+
当你打破这些规则时,你的组件可能仍然可以工作,但我们添加到 React 的大多数新功能将依赖于这些预期行为。阅读 [保持你的组件纯粹](/learn/keeping-components-pure#where-you-can-cause-side-effects) 以了解更多信息。
232+
```
232233

233234
</Pitfall>
234235

235236
---
236237

237238
### 通过 ref 操作 DOM {/*manipulating-the-dom-with-a-ref*/}
238239

239-
使用 ref 操作 [DOM](https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_DOM_API) 是非常常见的。React 对此有内置支持
240+
使用 ref 操作 [DOM](https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_DOM_API) 是非常常见的。React 内置了对它的支持
240241

241242
首先,声明一个 <CodeStep step={3}>initial value</CodeStep>`null`<CodeStep step={1}>ref 对象</CodeStep>
242243

@@ -265,7 +266,7 @@ function MyComponent() {
265266

266267
当节点从屏幕上移除时,React 将把 `current` 属性设回 `null`
267268

268-
阅读更多关于 [用 ref 操纵DOM](/learn/manipulating-the-dom-with-refs)
269+
阅读 [用 ref 操纵 DOM](/learn/manipulating-the-dom-with-refs) 以了解更多信息。
269270

270271
<Recipes titleText="Examples of manipulating the DOM with useRef" titleId="examples-dom">
271272

@@ -532,7 +533,7 @@ function Video() {
532533
// ...
533534
```
534535

535-
在这里,`playerRef` 本身是可以为空的。然而,你应该能够说服你的类型检查器,不存在 `getPlayer()` 返回 `null` 的情况。然后在你的事件处理程序中使用 `getPlayer()`
536+
在这里,`playerRef` 本身是可以为空的。然而,你应该能够使你的类型检查器确信,不存在 `getPlayer()` 返回 `null` 的情况。然后在你的事件处理程序中使用 `getPlayer()`
536537

537538
</DeepDive>
538539

@@ -573,7 +574,7 @@ export default function MyInput({ value, onChange }) {
573574
}
574575
```
575576

576-
然后像这样将其包装在 [`forwardRef`](/reference/react/forwardRef):
577+
然后像这样将其包装在 [`forwardRef`](/reference/react/forwardRef)
577578

578579
```js {3,8}
579580
import { forwardRef } from 'react';
@@ -593,4 +594,4 @@ export default MyInput;
593594

594595
然后,父级组件可以得到它的 ref。
595596

596-
阅读更多关于 [访问另一个组件的 DOM 节点](/learn/manipulating-the-dom-with-refs#accessing-another-components-dom-nodes)。
597+
阅读 [访问另一个组件的 DOM 节点](/learn/manipulating-the-dom-with-refs#accessing-another-components-dom-nodes) 了解更多信息

0 commit comments

Comments
 (0)