forked from EFUB/efub4-first-react-study
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SignUp.jsx
37 lines (33 loc) Β· 1.05 KB
/
SignUp.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, {useState} from "react";
function SignUp(props){
const [name,setName]=useState("");
const [gender,setGender]=useState("λ¨μ");
const handleChangeName=(event)=>{
setName(event.target.value);
};
const handleChangeGender=(event)=>{
setGender(event.target.value);
};
const handleSubmit=(event)=>{
alert(`μ΄λ¦: ${name}, μ±λ³: ${gender}`);
event.preventDefault();
};
return(
<form onSubmit={handleSubmit}>
<label>
μ΄λ¦:
<input type="text" value={name} onChange={handleChangeName}></input>
</label>
<br />
<label>
μ±λ³:
<select value={gender} onChange={handleChangeGender}>
<option value="λ¨μ">λ¨μ</option>
<option value="μ¬μ">μ¬μ</option>
</select>
</label>
<button type="submit">μ μΆ</button>
</form>
);
}
export default SignUp