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

91
Views
react-firebase-hook sign in with email and password error massage problem

I want to show error massage when a user want to log in with email and password and do not match. But my error massage show both time when email and password match and not match. This massage duration is like 1s. Anyone help me find wrong code.

const [signInWithEmailAndPassword, user, error] = useSignInWithEmailAndPassword(auth);
    const navigate = useNavigate()
    if (user) {
        navigate(from, { replace: true });
    }

    const handleLogin = async event => {
        event.preventDefault();
        const email = emailRef.current.value;
        const password = passwordRef.current.value;
        await signInWithEmailAndPassword(email, password);
        const { data } = await axios.post('https://powerful-depths-51836.herokuapp.com/login', { email });
        localStorage.setItem('accessToken', data.accessToken);
        // navigate(from, { replace: true });
    }
    let errorMassage;
    if (error) {
        console.log(error)
        errorMassage = <p className='text-red-600 font-bold text-center mt-2'>Please Enter Correct Email and Password</p>
    }

when I console.log(error) . all time its value is true;

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

const [signInWithEmailAndPassword, user, loading, error
] = useSignInWithEmailAndPassword(auth);

Add loading in your code, it will hopefully work.

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!