This commit is contained in:
haerong22
2020-12-17 16:39:11 +09:00
parent aafc454629
commit ee65cd737a

View File

@@ -32,22 +32,26 @@
value: '',
}
});
this.input.focus();
} else {
this.setState({
result: '땡',
value: '',
});
this.input.focus();
}
}
onChange = (e) => this.setState({ value: e.target.value});
onRefInput = (c) => { this.input = c; };
render() {
return (
<React.Fragment>
<div>{this.state.first} 곱하기 {this.state.second} ?</div>
<form onSubmit={this.onSubmit}>
<input type="number" value={this.state.value} onChange={this.onChange}/>
<input ref={this.onRefInput} type="number" value={this.state.value} onChange={this.onChange}/>
<button>입력!</button>
</form>
<div>{this.state.result}</div>