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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *