0

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.

2

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.