Last active
July 19, 2017 06:27
-
-
Save javarouka/c0bfd3e0038b0f93fc30f10ffdfb8339 to your computer and use it in GitHub Desktop.
forAsdf
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 SomeContainer extends Component { | |
state = { value: '' }; | |
changeText = (e) => this.setState({ | |
value: e.target.value | |
}); | |
componentDidMount() { | |
this.props.findOrder({ orderId: 100012134 }); | |
} | |
handleFocusTarget = () => { | |
// 포커스 | |
this.foucsTarget.focus(); | |
} | |
render() { | |
return ( | |
<div> | |
<h1>Hello?</h1> | |
{/* ref 에 담아둔다. */} | |
<input ref={targetInput => this.foucsTarget = targetInput} | |
onChange={this.changeText} value={this.state.value || ''}/> | |
<button onClick={this.handleFocusTarget}>포커싱</button> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment