Last active
June 22, 2018 15:07
-
-
Save hg-pyun/58bb1bdd61f936717781e5bf0154d7aa to your computer and use it in GitHub Desktop.
react v16.3.0 medium 02
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 MyComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.inputRef = React.createRef(); | |
} | |
render() { | |
return <input type="text" ref={this.inputRef} />; | |
} | |
componentDidMount() { | |
this.inputRef.current.focus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment