有错误:firestore.setListeners不是一个函数.同时将Redux-Firestore与React-Re



blockquote

照片(单击此处查看错误):发现错误:firestore.setListeners不是函数

blockquote

我刚刚集成了redux-saga,redux-firestore with react-redux-firebase@2。及其工作正常,但是当我尝试与其他组件集成时,我会收到此错误。任何解决方案!!谢谢

这是与React-Reduc-FireBase Redux-Firestore整合的错误白色

代码:

import { compose } from 'redux'
import { connect } from 'react-redux'
// import { getFirestore } from 'redux-firestore';
import {
  firestoreConnect,
  createWithFirebase,
  withFirebase,
  firebaseConnect
} from 'react-redux-firebase'
*******
**etc**
*******
// export default Inventory;
export default compose(
// firestoreConnect([{collection: 'Invetory'}]),
  firebaseConnect(),
  connect(
    ({ firestore }) => ({
      //todos: firestore.ordered.todos,
      firestore
    })
  )
  // connect((state) => ({
  //   auth: state.firestore.auth
  // })
)(Inventory)

react-redux-firebase的作者。

看起来您可能没有包括进口炸弹架,如React-Redux-Firebase文档的Firestore部分所述。确保您包括增强器,还原器和从firebase进口的火器,例如:

import { createStore, combineReducers, compose } from 'redux'
import firebase from 'firebase'
import 'firebase/firestore' // add this to use Firestore
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase'
import { reduxFirestore, firestoreReducer } from 'redux-firestore'
const firebaseConfig = {}
// react-redux-firebase config
const rrfConfig = {
  userProfile: 'users',
  // useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
}
// initialize firebase instance
firebase.initializeApp(firebaseConfig) // <- new to v2.*.*
// initialize Firestore
firebase.firestore()
// Add reduxReduxFirebase and reduxFirestore enhancers when making store creator
const createStoreWithFirebase = compose(
  reactReduxFirebase(firebase, rrfConfig),
  reduxFirestore(firebase)
)(createStore)
// Add Firebase and Firestore to reducers
const rootReducer = combineReducers({
  firebase: firebaseStateReducer,
  firestore: firestoreReducer
})
// Create store with reducers and initial state
const initialState = {}
const store = createStoreWithFirebase(rootReducer, initialState)

相关内容

  • 没有找到相关文章

最新更新