Reputation: 164
I m trying to fire base connectivity with react native
import * as firebase from 'firebase';
componentWillMount(){
var config = {
apiKey: "API_KEY",
authDomain: "*******-****.firebaseapp.com",
databaseURL: "https://*******-****.firebaseio.com",
projectId: "*******-****",
storageBucket: "*******-*****.appspot.com",
messagingSenderId: "************",
};
firebase.initializeApp(config);
console.log(firebase);
}
How do I solve this error?
Error:
TypeError: undefined is not a function (evaluating 'firebase.initializeApp(config)')
Upvotes: 0
Views: 155
Reputation: 35589
import it like
var firebase = require("firebase");
or
import firebase from ‘firebase’;
Upvotes: 1