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

191
Vistas
TypeError: _fire__WEBPACK_IMPORTED_MODULE_1__.default.auth is not a function

I am a beginner at React.js. I was following a tutorial to make a login authentication. I am getting this error (TypeError: fire__WEBPACK_IMPORTED_MODULE_1_.default.auth is not a function) from this part of the code: `

const authListener = () => {
    fire.auth().onAuthStateChanged((user) => {
      if (user) {
        clearInputs();
        setUser(user);
      } else {
        setUser("");
      }
    })
  };

` I've already searched every forum, topic, or Youtube video and still can't find the answer. Can someone tell me where the problem is and how to fix it? Appreciate everything.

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

0

If you are using the Modular SDK v9.0.0 then try refactoring your code like this:

import { initializeApp } from "firebase/app"
import { getAuth, onAuthStateChanged } from "firebase/auth"

const app = initializeApp(app)
const auth = getAuth(app)

const authListener = () => {
  onAuthStateChanged(auth, (user) => {
    if (user) {
      console.log(user)
    }
  })
}

If you want to use the older namespaced syntax (firebase.auth()) then change your imports to compat version:

import firebase from "firebase/comapt/app"
import "firebase/compat/auth"

You can read more about upgrading to modular SDK in the documentation.

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