Home > Back-end >  how do i initialize my app using firebase
how do i initialize my app using firebase

Time:02-21

am trying to initailize app in my firebase project but it not working instead am getting TypeError: Cannot read properties of undefined (reading 'apps'), please am i doing wrong here

this is my code import firebase from 'firebase/app';

const app = !firebase.apps.length 
  ? firebase.initializeApp(firebaseConfig)
  : firebase.app();

CodePudding user response:

firebase.apps is not existing or is probably not defined

Try initializing firebase like this const app = firebase.initializeApp(firebaseConfig);

I got that from the official firebase documentation

CodePudding user response:

use .getApps() instead of .apps

  • Related