I\'m trying to create a project in React and I\'m using Firebase. In my react-redux-firebase project one line of code making error but I couldn\'t fix that. How could I fix
Please use this npm packages
npm packages compatibility issue
npm i --save react-redux@5.1.1 react-redux-firebase@2.2.4
Option 01- adjust npm package versions for
react-redux & react-redux-firebase
npm install react-redux@5.1.1 react-redux-firebase@2.2.4
Option 02- Refer v3 ( http://react-redux-firebase.com/docs/v3-migration-guide.html )
This is a react-redux-firebase v2.x.x coding pattern and you probably have v3.x.x installed.
npm ls react-redux-firebase
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