Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

261
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda