Last active
January 11, 2017 20:22
-
-
Save joaolucasl/f3c60e593531dbb265cefabbfdc871f1 to your computer and use it in GitHub Desktop.
Comunicacao de Componentes React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentComponent extends React.Component | |
{ | |
render() { | |
return ( | |
<input type="text" ref={(field) => this.editText = field} /> | |
) | |
} | |
componentDidMount() { | |
if (this.editText !== null) { | |
this.editText.focus() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentComponent extends React.Component | |
{ | |
render() { | |
return ( | |
<input type="text" ref="editText"/> | |
) | |
} | |
componentDidMount() { | |
this.refs.editText.focus() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment