1

this is my code. I am new to react native and trying to make a firebase authanticator using firebase in expo. please hell me with this error. I am facing similar issue for other things related to firebase also.

import firebase from "firebase/app";
import "firebase/auth";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

// Your web app's Firebase configuration
const firebaseConfig = {
  apiKey: "removed",
  authDomain: "removed",
  databaseURL: "removed",
  projectId: "removed",
  storageBucket: "removed",
  messagingSenderId: "removed",
  appId: "removed"
};

// Initialize Firebase
let app;
if(firebase.apps.length === 0){
    app = firebase.initializeApp(firebaseConfig);
}else{
    app = firebase.app()
}

const auth = firebase.auth
export { auth };```

Angel Luis
  • 487
  • 2
  • 5
  • 19

1 Answers1

0

see How to check if a Firebase App is already initialized on Android

and switch to s/t like

import { initializeApp, getApps, getApp } from "firebase/app";
getApps().length === 0 ? initializeApp(firebaseConfig) : getApp();
Kirween
  • 1,472
  • 1
  • 19
  • 24
Jason Farkas
  • 1
  • 1
  • 1