Skip to content

Instantly share code, notes, and snippets.

@warderer
Last active June 25, 2024 02:08
Show Gist options
  • Select an option

  • Save warderer/609ef41b6e934597105914aa70ccc0f2 to your computer and use it in GitHub Desktop.

Select an option

Save warderer/609ef41b6e934597105914aa70ccc0f2 to your computer and use it in GitHub Desktop.
[React Forms Base] Formularios base para el curso de React
import logo from '../assets/react.svg'
const ReactHookForm = () => {
return (
<div className='login'>
<div className='login-container'>
<img src={logo} alt='logo' />
<form
onSubmit={() => { }/* HANDLE SUBMIT */}
style={{ display: 'flex', flexDirection: 'column' }}
>
<label htmlFor='firstName'>Nombre</label>
<input
type='text'
name='firstName'
placeholder='Tu Nombre'
id='firstName'
/>
<label htmlFor='lastName'>Apellido</label>
<input
type='text'
name='lastName'
placeholder='Tu Apellido'
id='lastName'
/>
<label htmlFor='age'>Edad</label>
<input
type='number'
name='age'
placeholder='Tu Edad'
id='age'
/>
<label htmlFor='gender'>Genero</label>
<select name='gender' id='gender'>
<option value=''>Elige un genero</option>
<option value='M'>Masculino</option>
<option value='F'>Femenino</option>
<option value='O'>Otro</option>
</select>
<label htmlFor='email'>Email</label>
<input
type='text'
name='email'
placeholder='correo@mail.com'
id='email'
/>
<label htmlFor='password'>Password</label>
<input
type='password'
name='password'
id='password'
/>
<button type='submit'>
Iniciar Sesion
</button>
</form>
</div>
</div>
)
}
export default ReactHookForm
import logo from '../assets/react.svg'
const SimpleForm = () => {
return (
<div className='login'>
<div className='login-container'>
<img src={logo} alt='logo' />
<form onSubmit={() => {}/* HANDLE SUBMIT */}>
<label htmlFor='email'>Email</label>
<input
type='text'
name='email'
placeholder='correo@mail.com'
id='simple-email'
onChange={() => {}/* HANDLE INPUT */}
value=''
/>
<label htmlFor='password'>Password</label>
<input
type='password'
name='password'
id='simple-password'
onChange={() => {}/* HANDLE INPUT */}
value=''
/>
<button type='submit'>
Iniciar Sesion
</button>
</form>
</div>
</div>
)
}
export default SimpleForm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment