Newer
Older
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { useState } from "react";
import Input from "./Input";
import Button from "./Button";
import { useNavigate } from "react-router-dom";
function HomeParticipateForm() {
const [name,setName] = useState("");
const [password,setPassword] = useState("");
const [email,setEmail] = useState("");
const navigate = useNavigate();
const handleName = (event)=>{
setName(event.target.value);
}
const handlePassword = (event)=>{
setPassword(event.target.value);
}
const handleEmail = (event)=>{
setEmail(event.target.value);
}
const handleSubmit = (event) => {
event.preventDefault();
name === "" ? alert('이름을 입력하세요') : navigate('UserTimeInfo');
};
return (
<form>
<div>
<h1>약속 Title</h1>
<Input
type="text"
value={name}
onChange={handleName}
placeholder="이름"
/>
<Input
type="password"
value={password}
onChange={handlePassword}
placeholder="Password(선택)"
/>
<Input
type="text"
value={email}
onChange={handleEmail}
placeholder="이메일(선택)"
/>
<Button
type='submit'
text='다음'
onClick={handleSubmit}
/>
</div>
</form>
);
}
export default HomeParticipateForm;