Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
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 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!