1

While trying to implement Firebase into my react project I am getting this error.

TypeError: Object(...) is not a function.

This is what the code looks like

// Add reactReduxFirebase enhancer when making store creators
// const createStoreWithFirebase = compose(
//     reactReduxFirebase(firebase, rrfConfig), // firebase instance as first argument
//     reduxFireStore(firebase)
// )(createStore);

// 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, compose(
    reactReduxFirebase(firebase),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
));

export default store;

And this is what the error looks like,

TypeError: Object(...) is not a function

Module.<anonymous>
D:/Learning React/client-panel/src/store.js:45
  42 | 
  43 | // Create store with reducers and initial state
  44 | const initialState = {};
> 45 | const store = createStore(rootReducer, initialState, compose(
  46 |     reactReduxFirebase(firebase),
  47 |     window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  48 | ));

Also, everytime I uncomment the "Add reactReduxFirebase enhancer when making store creators" line, it starts showing "reduxFireStore" is not defined.

I would be a great help if someone could provide some insights regarding this. Note: I am using the react-redux-firebase-library

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • 1
    Hi, I just answered this on a different question: [Cannot call reactReduxFirebase() - TypeError: Object is not a function](https://stackoverflow.com/questions/66536513/cannot-call-reactreduxfirebase-typeerror-object-is-not-a-function) Voting to close yours as a duplicate. – Linda Paiste Mar 08 '21 at 22:07

0 Answers0