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

301
Vistas
Can't use firebase in React component, because it's not initialized

I'm trying to initialize firebase in my App.js, so that I can utilize the user's auth state throughout multiple scenes. My Sign In/Sign Out logic is tied to 2 seperate button components that are conditionally rendered in my header.

I'm receiving this error, which leads me to believe that the buttons are using "firebase" before it's init'd.

Uncaught FirebaseError: Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app-compat/no-app).

App.JS

import React from 'react';
import firebase from 'firebase/compat/app';
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
import Header from './components/core/Header';

firebase.initializeApp({...});

const App = () => (
  <div className="App">
    <Header />
  </div>
)

Is there a way I can initialize firebase to my whole application before the import of Header? Or can I not separate the signIn/Out logic from my App.js?

about 4 years ago · Juan Pablo Isaza
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