reactjs – firebase2.default.firestore不是函数 – React Firebase

前端之家收集整理的这篇文章主要介绍了reactjs – firebase2.default.firestore不是函数 – React Firebase前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我的reactjs应用程序中使用firestore.

当我从firebase配置对象调用firestore时.

它说

firebase2.default.firestore is not a function

这是代码

import firebase from 'firebase'

const config = {
  apiKey: "AIzaSxxxxxxqpUeqKXI",authDomain: "payxxxxxa1.firebaseapp.com",databaseURL: "https://payxxxxxxxa1.firebaseio.com",projectId: "payxxxxxxja1",storageBucket: "payxxxxxa1.appspot.com",messagingSenderId: "281xxxxxxxx576"
}

firebase.initializeApp(config)

export const fire = firebase
export const ref = firebase.database().ref()
export const firebaseAuth = firebase.auth
export const messaging = firebase.messaging();
export const db = firebase.firestore();

Firebase版本是4.5.0

npm list firebase > firebase@4.5.0

我做错了吗?

ES6:

import’@ firebase / firestore’

参考:https://www.npmjs.com/package/@firebase/firestore

原文链接:https://www.f2er.com/react/301122.html

猜你在找的React相关文章