Sometimes, we want to fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript.
In this article, we’ll look at how to fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript.
How to fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript?
To fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript, we need to import the Firestore modules.
For instance, we write
import firebase from "firebase/app";
import "firebase/firestore";
to imoort firebase
and firebase/firestore
to import the required dependencies.
Conclusion
To fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript, we need to import the Firestore modules.