1

Hola estoy intentando hacer un login como el de hakerrank que al colocar el email y darle "next" se quite el input email y aparezca el de password y el botón cambie a "iniciar sesión" Hago esto y funciona bien

 const[next,setNext]= useState(false);

const onClick = (e) => {
  if(e.type === 'click){
   setNext(true)
}
}

return(
 <form onSubmit={onSubmit}>
   <input type="email" className={next? 'mb-2': 'd-none'} />
   <input type="password" className={next? 'd-none' : 'mb-2'} />
<button onClick={onClick} type="submit">{next? 'Iniciar sesion' : 'siguiente'}<\button>
</form>
)

Pero se que puede haber algo mejor para hacer. Gracias.

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.