-
Notifications
You must be signed in to change notification settings - Fork 32
[React] Formularios
José Bocanegra edited this page Mar 19, 2021
·
5 revisions
Cree un nuevo componente denominado signup.js con el siguiente contenido:
function Signup() {
return (
<div>
<form>
<div>
<label htmlFor="email">Email</label>
<input
type="email"
id="email"
name="email"
autoComplete="password"
/>
</div>
<div>
<label htmlFor="password">Password</label>
<input
type="password"
id="password"
name="password"
autoComplete="password"
/>
</div>
<div>
<label htmlFor="repeat_password">Confirm password</label>
<input
type="password"
id="repeat_password"
name="repeat_password"
autoComplete="password"
/>
</div>
<button type="submit">Register</button>
</form>
</div>
);
}
export default Signup;Cree un hook para manejar el evento submit del formulario. Para esto, cree el archivo customHooks.js con el siguiente contenido:
const useSignUpForm = (schema) => {
const handleSubmit = (event) => {
event.preventDefault();
console.log("Form submitted");
};
return { handleSubmit };
};
export default useSignUpForm;ISIS-3710 Programación con Tecnologías Web
Universidad de los Andes, Colombia