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

165
Vistas
Should I initialize Firebase on my web for every js file

Should i initialize my const firebaseConfig = {}; for every js file? on html

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

0

Nope, just once. If possible on the root js file

about 4 years ago · Juan Pablo Isaza Denunciar

0

You haven't mentioned the type of project you are working on.

Here is how it is done in React project

  1. Create Firebase folder under src in React project
  2. Create config.js in Firebase folder

Initialize the app in config.js and export it

import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";

// Replace the following with your app's Firebase project configuration
const firebaseConfig = {
  apiKey: //your API key,
  authDomain: "random-project.com"
};

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);

export {app, db}
 // some other file 
 import { db } from '../Firebase/config';
 const citiesCol = collection(db, 'cities');
 const citySnapshot = await getDocs(citiesCol);

You can read in more depth in official docs here:https://firebase.google.com/docs/web/setup

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