I Keep Getting This Error Firebase: Firebase App Named '[DEFAULT]' Already Exists (app/duplicate-app)
import React, { Component } from 'react' import './App.css'; import 'bootstrap/dist/css/bootstrap.min.css'; import firebase from 'firebase/app'; import 'firebase/database'; impor
Solution 1:
If this is the only place you call initializeApp
, it might be that the component is created multiple times.
If you can't find a spot that is guaranteed to be called only once, I usually find it easiest to explicitly check if we're initialized Firebase before with:
if (firebase.apps.length === 0) {
this.app = firebase.initializeApp(config);
this.database = this.app.database();
}
Post a Comment for "I Keep Getting This Error Firebase: Firebase App Named '[DEFAULT]' Already Exists (app/duplicate-app)"