Issue
This is My full code
import { initializeApp } from "firebase/app";
import { getAuth } from "firebase/auth";
const firebaseConfig = {
apiKey: "APIKEY",
authDomain: "AUTHDOMAIN",
projectId: "PROJID",
storageBucket: "BUCKET",
messagingSenderId: "SOMEID",
appId: "APPID",
measurementId: "IDDDDD"
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
So I don't know What is happening with my code and How can I fix it? All my code is seem alright and not having any error D:
Solution
Sometimes, when you import the firebase.js file in multiple other files, it may try to create two instances of the app. To prevent this, make use of the following code:
const app = !getApps().length ? initializeApp(firebaseConfig) : getApp();
Just be sure to import getApps() and getApp().
Answered By - HittuDesai

0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.