Categories
JavaScript Answers

How to fix firebase.firestore() is not a function when trying to initialize Cloud Firestore with JavaScript?

Spread the love

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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.