Reputation: 11
I gets this error but when u hover mouse cursor on the .firestore() then in snippet it defines it as a function but on compilation/web it shows the following error. help me to solve it
**firebase__WEBPACK_IMPORTED_MODULE_1___default.a.firestore is not a function**
3 | import 'firebase/firestore';
4 |
5 | import { getFirestore } from "firebase/firestore"
> 6 | const firestore = firebase.firestore();
7 | const firebaseConfig = {
8 | apiKey: "--------",
9 | authDomain: "--------",
Upvotes: 0
Views: 639
Reputation: 1745
The method you use is before version 9, if your are useing firebase v9.x.x, the method changed.
Here is the (v9) Firebase official document.
Here is the (v8 or before) Firebase official document.
Simple example :
import { getFirestore } from "firebase/firestore";
import { initializeApp } from "firebase/app";
const firebaseConfig = {
apiKey: "xxxxx",
authDomain: "xxxx",
projectId: "xxxx",
storageBucket: "xxxx",
messagingSenderId: "xxxx",
appId: "xxxxx",
measurementId: "xxxxx"
};
const firebase = initializeApp(firebaseConfig);
const db = getFirestore();
export { firebase, db };
Upvotes: 1