I am trying to connect my app with firbase using firebase.initializeApp but it is keep giving me an error that TypeError: firebase.initializeApp is not a function. (In 'firebase.initializeApp(_config.firebaseConfig)', 'firebase.initializeApp' is undefined. I tried to search answers on stackoverflow but most of the correct answers is around importing right library or correcting typo in the code.
I am very sure that I am importing the right library and using firebase.initializeApp in correct order. But, I am still getting same error. Can any one help?
Please note (not sure it is important) - This all started when I start implementing redux in my app
Below is my code:
config.js
export const firebaseConfig = {
apiKey: "**********",
authDomain: "**********",
databaseURL: "**********",
projectId: "**********",
storageBucket: "**********",
messagingSenderId: "**********",
appId: "**********",
measurementId: "**********",
};
app.js - This where I need to call funtion firebase.initializeApp fuction to connect my app with firebase.
import * as firebase from "firebase/app";
import { firebaseConfig } from "./config/config";
import "firebase/auth";
import "firebase/firestore";
class App extends React.Component {
constructor() {
super();
this.initializeFirebaase();
}
initializeFirebaase = () => {
firebase.initializeApp(firebaseConfig);
};
render() {
return (
<Provider store={store}>
<AppContainer />
</Provider>
);
}
}