Question: I'm creating a social app and I got this error. What should I do?

This is my config file:

```
import * as firebase from "firebase/app";

const FirebaseKey = { 

   apiKey: "****",
   authDomain: "****",
   databaseURL: "****",
   projectId: "****", 
   storageBucket: "****",
   messagingSenderId: "****", 
   appId: "****" 

};

export default !firebase.apps.length ? firebase.initializeApp(FirebaseKey) : firebase.app();

```

And this is my Fire.js file's beginning (here is the mistake):

```
import FirebaseKeys from "./Config";
import firebase from "./App";
require("firebase/firestore");

class Fire {
    constructor() {
        firebase.initializeApp(FirebaseKeys);
    }

```

Answer: 
In firebase 8.0.0 and above it is

```
import firebase from 'firebase'

```

and for firebase <8.0.0

it is

```
import * as firebase from 'firebase'

```
You're exporting a `FirebaseApp` instance, and not the `firebase` namespace that surrounds it. So with your current config file, you:

1. Don't have to call `firebase.initializeApp(FirebaseKeys);` in your `Fire.js` anymore.
2. Can access the services directly from your import: `firebase.firestore()`.

---

But I'd recommend exporting the `firebase` namespace:

```
import * as firebase from "firebase/app";

const FirebaseKey = { 

   apiKey: "****",
   authDomain: "****",
   databaseURL: "****",
   projectId: "****", 
   storageBucket: "****",
   messagingSenderId: "****", 
   appId: "****" 

};

if (!firebase.apps.length) firebase.initializeApp(FirebaseKey)

export default firebase;

```

And then:

```
import FirebaseKeys from "./Config";
import firebase from "./App";
require("firebase/firestore");

class Fire {
    constructor() {
        firebase.firestore()... // access the database
    }

```