Skip to content

Commit

Permalink
Update content/docs/refs-and-the-dom.md
Browse files Browse the repository at this point in the history
Co-Authored-By: pampang <fspwz@sina.com>
  • Loading branch information
yuqingc and pampang committed Mar 24, 2019
1 parent 7098e2c commit ea86077
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/docs/refs-and-the-dom.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class Parent extends React.Component {

在上面的例子中,`Parent` 把它的 refs 回调函数当作 `inputRef` props 传递给了 `CustomTextInput`,而且 `CustomTextInput` 把相同的函数作为特殊的 `ref` 属性传递给了 `<input>`。结果是,在 `Parent` 中的 `this.inputElement` 会被设置为与 `CustomTextInput` 中的 `input` 元素相对应的 DOM 节点。

### 旧版 API:String 类型的 Refs {#legacy-api-string-refs}
### 过时 API:String 类型的 Refs {#legacy-api-string-refs}

如果你之前使用过 React,你可能了解过之前的 API 中的 string 类型的 ref 属性,例如 `"textInput"`。你可以通过 `this.refs.textInput` 来访问 DOM 节点。我们不建议使用它,因为 string 类型的 refs 存在 [一些问题](https://github.com/facebook/react/pull/8333#issuecomment-271648615)。它已过时并可能会在未来的版本被移除。

Expand Down

0 comments on commit ea86077

Please sign in to comment.