직접 form를 제어하는 것은 너무 힘든 일이다 🥲
그래서 등장했다!
yarn add react-hook-form
import { useForm } from "react-hook-form";
export default function Forms() {
const { **register** } = useForm();
return (
<form>
<input
{...register("username", { required: true })}
type="text"
placeholder="Username"
/>
<input
{...(register("email"), { required: true })}
type="email"
placeholder="Email"
/>
<input
{...(register("password"), { required: true })}
type="password"
placeholder="Password"
/>
<input type="submit" value="Create Account" />
</form>
);
}