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

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

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 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