Created
December 4, 2022 14:41
-
-
Save rizkiramadhanx/e0c7590e17d2875f6fb7ec67da74eb0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useForm } from "react-hook-form"; | |
const DefaultValue = () => { | |
const { register, handleSubmit } = useForm({ | |
defaultValues: { | |
firstName: "oji", | |
lastName: "ramadhan" | |
} | |
}); | |
const onSubmit = (data) => console.log(data); | |
return ( | |
<form onSubmit={handleSubmit(onSubmit)}> | |
<label>firstName :</label> | |
<input {...register("firstName")} /> | |
<label>lastName :</label> | |
<input {...register("lastName")} /> | |
<button type="submit" className="submitbtn"> | |
submit | |
</button> | |
</form> | |
); | |
}; | |
export default DefaultValue; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment