Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

273
Vistas
Cannot send password reset mail by getting user email with const email= event.target.email.value in React

Is there any way to send the below password reset mail by getting user email, const email = event.target.email.value, I have tried but due to the async function, I cannot pass the event parameter? FYI - I am using react hook to send password reset mail. Below code screenshot for your reference.

Finally, I have used here useRef to send reset mail. How can I pass event as a parameter into the async function to send password reset mail?

My code:

const [sendPasswordResetEmail, sending] = useSendPasswordResetEmail(auth);

const handleSubmit = event => {
    event.preventDefault();
    const email = event.target.email.value;
    const password = event.target.password.value;
    signInWithEmailAndPassword(email, password)
}

if (loading || sending) {
    return <Loading></Loading>
}

let from = location.state?.from?.pathname || "/";
let loginError;

const navigateRegister = () => {
    navigate('/register')
}

const resetPassword = async () => {
    const email = emailRef.current.value;
    await sendPasswordResetEmail(email);
    if (email) {
        toast('Sent email');
    } else {
        toast('please enter your email address!!')
    }
}

Code Screenshot

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try using emailRef.current.value to get the email, as seen in resetPassword in your code.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda