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

97
Vistas
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 Respuestas
Responde la pregunta

0

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

Add loading in your code, it will hopefully work.

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