React Hooks
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
|
||||
const onSubmitForm = (e) => {
|
||||
e.preventDefault();
|
||||
if(parseInt(this.state.value) === this.state.first * this.state.second) {
|
||||
if(parseInt(value) === first * second) {
|
||||
setResult('정답: ' + value);
|
||||
setFirst(Math.ceil(Math.random() * 9));
|
||||
setSecond(Math.ceil(Math.random() * 9));
|
||||
@@ -38,14 +38,14 @@
|
||||
}
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<div>{first} 곱하기 {second}는?</div>
|
||||
<form onSubmit={}>
|
||||
<input ref={inputRef} onChange={onChangeInput} value={value} />
|
||||
<button>입력!</button>
|
||||
</form>
|
||||
<div id="result">{result}</div>
|
||||
</React.Fragment>
|
||||
<React.Fragment>
|
||||
<div>{first} 곱하기 {second}는?</div>
|
||||
<form onSubmit={onSubmitForm}>
|
||||
<input ref={inputRef} onChange={onChangeInput} value={value} />
|
||||
<button>입력!</button>
|
||||
</form>
|
||||
<div id="result">{result}</div>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user