onSubmit = (e) => {
e.preventDefault();
if(parseImt(this.state.value) ===this.state.first * this.state.second){
this.serState((prevState)=>{
return {
result : "" +prevState.value,
first : Math.ceil(Math.random() * 9)
};
});
this.input.focus(); // 다시 입력창에 포커스
}else {
this.setState({
result : "".
value:'',
})
}
};
input;
onRefInput = (c) = { this.input = c };
render(){
return(
<>
<form onSubmit={this.onSubmit>
<input ref ={ this.onRefInput } type="" value ={this. state. value}
inChange={this.onChange}/>
</form>
<div>{this.state.result}</div>
</>
)
}