"TypeError: Object(...) is not a function" react-redux-firebase
Please use this npm packages
npm packages compatibility issue
npm i --save [email protected] [email protected]
The reactReduxFirebase store enhancer is removed in the version v3 and above. You can now create firebase instance using context providers. The same can now be done as:
const store = createStore(
rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
reduxFirestore(fbConfig)
)
);
const rrfProps = {
firebase,
config: fbConfig,
dispatch: store.dispatch
}
const App = () => (
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<Todo /> // your Component
</ReactReduxFirebaseProvider>
</Provider>
);
As of now the 'reduxFirestore' is working fine so I want to leave it as it is but I assume the same will happen to it in coming days. So its a good idea to omit compose and reduxFirestore(fbConfig) and instead use:
import { createFirestoreInstance } from 'redux-firestore'
and add createFirestoreInstance to rrfProps as below:
const rrfProps = {
firebase,
config: rrfConfig,
dispatch: store.dispatch,
createFirestoreInstance
}
For more information checkout: http://react-redux-firebase.com/docs/v3-migration-guide.html#remove-createFirebaseConnect-and-createFirestoreConnect
This is a react-redux-firebase v2.x.x coding pattern and you probably have v3.x.x installed.
- Check which version of react-redux-firebase you are using:
npm ls react-redux-firebase
- If the version is 3.0.0 or higher, you need to migrate your code to the new coding pattern. See React-Redux-Firebase v3.x.x Migration Guide for detailed instructions.