This commit is contained in:
Rico Sta. Cruz 2017-08-24 06:30:53 +08:00
parent d0142fb682
commit d95efb54c5
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 10 additions and 5 deletions

View File

@ -167,14 +167,19 @@ DOM nodes
### References ### References
```html ```jsx
<input ref="myInput"> class MyComponent extends React.Component {
render () {
return <div>
<input ref={el => this.input = el} />
</div>
}
}
``` ```
```jsx ```jsx
this.refs.myInput this.input.focus()
ReactDOM.findDOMNode(this.refs.myInput).focus() this.input.value()
ReactDOM.findDOMNode(this.refs.myInput).value
``` ```
Allows access to DOM nodes. See [References](http://facebook.github.io/react/docs/more-about-refs.html). Allows access to DOM nodes. See [References](http://facebook.github.io/react/docs/more-about-refs.html).