When you go to the second tab, it gives an error

"Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app)." 

Connect to database

 export const DB_CONFIG = { apiKey: "", authDomain: "", databaseURL: "", projectId: "", storageBucket: "", messagingSenderId: "" }; 

I call on 2 pages

 import firebase from 'firebase'; import {DB_CONFIG} from '../Config.js' this.app = firebase.initializeApp(DB_CONFIG); this.database = this.app.database().ref('driversApp/ordersData/').child(key); 
  • And why DB_CONFIG config is empty? Maybe this is the cause of the error? - nick_n_a
  • everything is filled there - Alinochka2579

1 answer 1

Solution to the problem

 import * as firebase from 'firebase'; const settings = {timestampsInSnapshots: true}; const config = { apiKey: "", authDomain: "", databaseURL: "", projectId: "", storageBucket: "", messagingSenderId: "" }; firebase.initializeApp(config); firebase.database(); export default firebase; 

We do authorization only once, and then call where this.provision should be this.database = firebase.database (). Ref ('driversApp / ordersData /'). Child (key);