K20GH K20GH - 4 years ago 210
React JSX Question

firebase.initializeApp is not a function

I'm trying to make a site in React, and I have added the Firebase library using

npm i firebase --save

I am then trying to call this in my app, but I am not having much joy:

import * as firebase from "firebase";

const instance = firebase.initializeApp({
apiKey: '123',
authDomain: 'https://123.firebaseapp.com/',
databaseURL: 'https://123.firebaseio.com/'

export default instance;

No matter what I try, it throws:

firebase.initializeApp is not a function

I've checked its in my node_modules and i've reinstalled it, but I still have no such luck.

Any suggestions?

Answer Source

Can you please try with:

var firebase = require('firebase/app');


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download