Form name/gender, pushed to console. React JS
Thu May 27 2021 11:00:52 GMT+0000 (UTC)
Saved by
@yvonneLucchi
#react.js
function App() {
const { register, handleSubmit } = useForm();
const onSubmit = data => console.log(data);
return (
<>
<form onSubmit={handleSubmit(onSubmit)}>
<label htmlFor="name">Naam</label>
<input {...register("firstName")} />
<select {...register("gender")}>
<option value="female">female</option>
<option value="male">male</option>
<option value="other">other</option>
</select>
</form
</>
);
}
export default App;
content_copyCOPY
Easy and simple code for a name and gender form.
Comments