[英]TypeError: Object(...) is not a function (anonymous function)
having a problem initializing the Firestore.初始化 Firestore 时遇到问题。 Here is the code:
这是代码:
In store.js在 store.js
import { combineReducers, compose, createStore } from 'redux';
import firebase from 'firebase';
import 'firebase/firestore';
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase';
import { reduxFirestore, firestoreReducer } from 'redux-firestore';
//Reducers
const firebaseConfig = {};
// react-redux-firebase config
const rrfConfig = {
userProfile: 'users',
useFirestoreForProfile: true,
};
//init firebase instance
firebase.initializeApp(firebaseConfig);
//init firestore
const firestore = firebase.firestore();
//adding reactReduxFirebase enhencer
firebase.firestore(); // <- needed if using firestore
const rootReducer = combineReducers({
firebase: firebaseReducer,
firestore: firestoreReducer,
});
//create initial state
const initialState = {};
const store = createStore(
rootReducer,
initialState,
compose(
reactReduxFirebase(firebase),
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
export default store;
In App.js在 App.js 中
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import store from './store';
function App() {
return (
<Provider store={store}>
<Router>
<div className="App">
<AppNavbar></AppNavbar>
<Switch>
<Route exact path="/" component={Dashboard} />
</Switch>
</div>
</Router>
</Provider>
);
}
export default App;
Here is the error log |这是错误日志 | //create initial state 40 |
//创建初始值 state 40 | 41 |
41 | const initialState = {};
const 初始状态 = {};
42 |
42 | const store = createStore( 43 | rootReducer, 44 | initialState, 45 | compose(reactReduxFirebase(firebase))
const store = createStore( 43 | rootReducer, 44 | initialState, 45 | compose(reactReduxFirebase(firebase))
Any help is appreciated.任何帮助表示赞赏。
The problem is specifically with calling reactReduxFirebase
as it is not a function.问题特别在于调用
reactReduxFirebase
,因为它不是 function。
I'm not too familiar with the 'react-redux-firebase' package, but it appears that this function was removed from the latest version.我不太熟悉 'react-redux-firebase' package,但似乎这个 function 已从最新版本中删除。
Instead of applying this enhancer to your store, it is now recommended that you wrap your app in a ReactReduxFirebaseProvider
.现在建议您将应用程序包装在
ReactReduxFirebaseProvider
中,而不是将此增强器应用于您的商店。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.