为什么反应还原火球不是一个功能



我正在学习firestore与react native的集成,并收到了这个非常奇怪的错误。在这段代码中,在另一个文件中创建了带有增强子的存储,然后在主App.js文件中使用该存储。如有任何帮助,我们将不胜感激。

出现在手机上的错误

store.js

import { createStore, compose } from 'redux'
import { reactReduxFirebase,getFirebase } from 'react-redux-firebase'
import { reduxFirestore,getFirestore } from 'redux-firestore'
import ReduxThunk from 'redux-thunk';
import { initialState, rootReducer } from '../Reducers/index.js'
import fbConfig from './fbConfig'
import firebase from 'firebase/app'
import 'firebase/firestore'
if (!firebase.apps.length) {
firebase.initializeApp(fbConfig)
}

const enhancers = [
reduxFirestore(firebase),
reactReduxFirebase(firebase, {
userProfile: 'Movies',
useFirestoreForProfile: true,
})
]
const reduxDevToolsExtension = window.devToolsExtension
if (
process.env.NODE_ENV === "development" &&
typeof reduxDevToolsExtension === "function"
) {
enhancers.push(reduxDevToolsExtension())
}
const composedEnhancers = compose(
...enhancers,
applyMiddleware(thunk.withExtraArgument({getFirebase,getFirestore}))
)
const store = createStore(rootReducer, initialState, composedEnhancers)

export default store

App.js

import React, { Component } from 'react';
import { Provider } from 'react-redux';
import {View,Platform,StatusBar} from 'react-native';
import { createStore, applyMiddleware } from 'redux';
import ReduxThunk from 'redux-thunk';
import reducers from './src/Reducers';
import SafeAreaView from 'react-native-safe-area-view';
import RootNav from './src/Navigator';
import store from './src/config/store.js'
import TheatreList from './src/Components/TheatreList';

class App extends Component {
render() {
return (
<View style={{flex:1}}>
<Provider store={store}>
<RootNav />
</Provider>
</View>
);
}
}
export default App;

我认为您尝试使用的是错误的。你想用的似乎是这个。

示例

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import firebase from 'firebase/app'
import 'firebase/auth'
// import 'firebase/firestore' // <- needed if using firestore
// import 'firebase/functions' // <- needed if using httpsCallable
import { createStore, combineReducers, compose } from 'redux'
import { ReactReduxFirebaseProvider, firebaseReducer } from 'react-redux-firebase'
// import { createFirestoreInstance, firestoreReducer } from 'redux-firestore' // <- needed if using firestore
const fbConfig = {}
// react-redux-firebase config
const rrfConfig = {
userProfile: 'users'
// useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
}
// Initialize firebase instance
firebase.initializeApp(fbConfig)
// Initialize other services on firebase instance
// firebase.firestore() // <- needed if using firestore
// firebase.functions() // <- needed if using httpsCallable
// Add firebase to reducers
const rootReducer = combineReducers({
firebase: firebaseReducer
// firestore: firestoreReducer // <- needed if using firestore
})
// Create store with reducers and initial state
const initialState = {}
const store = createStore(rootReducer, initialState)
const rrfProps = {
firebase,
config: rrfConfig,
dispatch: store.dispatch,
// createFirestoreInstance // <- needed if using firestore
}
// Setup react-redux so that connect HOC can be used
function App() {
return (
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<Todos />
</ReactReduxFirebaseProvider>
</Provider>
);
}
render(<App />, document.getElementById('root'))

最新更新