Skip to content

Instantly share code, notes, and snippets.

@javarouka
Last active July 19, 2017 06:27
Show Gist options
  • Save javarouka/c0bfd3e0038b0f93fc30f10ffdfb8339 to your computer and use it in GitHub Desktop.
Save javarouka/c0bfd3e0038b0f93fc30f10ffdfb8339 to your computer and use it in GitHub Desktop.
forAsdf
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