having a problem initializing the Firestore. Here is the code:
In 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
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 | 41 | const initialState = {};
42 | 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.I’m not too familiar with the 'react-redux-firebase' package, but it appears that this function was removed from the latest version.
Instead of applying this enhancer to your store, it is now recommended that you wrap your app in a
ReactReduxFirebaseProvider
.