728x90
export default function Login() {
function handleSubmit(event){
event.preventDefault();
const fd = new FormData(event.target);
const email = fd.get("email");
const password = fd.get("password");
const address = fd.get("address");
console.log(email, password, address)
}
return (
<>
<h2>Signup</h2>
<form onSubmit={handleSubmit}>
<div>
<div>
<label htmlFor="email">Email</label>
<input id="email" name="email" type="email"></input>
</div>
</div>
<div>
<div>
<label htmlFor="password">password</label>
<input id="password" name="password" type="password"></input>
</div>
</div>
<div>
<div>
<label htmlFor="address">address</label>
<input id="address" name="address" type="text"></input>
</div>
</div>
<div>
<div>
<label htmlFor="address2">address2</label>
<input id="address2" name="address2" type="text"></input>
</div>
</div>
<p>
<button>Login</button>
</p>
</form>
</>
);
}
'단순 코드 기록 > React' 카테고리의 다른 글
React_css(내부파일 / 외부파일 / styled-components) (0) | 2024.03.22 |
---|---|
React_유효성검사 (0) | 2024.03.22 |
React_로그인폼(useState / useRef) (0) | 2024.03.22 |
React_Action함수를 이용한 Form 전송 (0) | 2024.03.21 |
React_Error별 메세지 출력 (0) | 2024.03.21 |