react-redux v6 a v3.*.* version of react-redux-firebase is required

北慕城南 提交于 2019-12-04 17:55:19

问题


I've been working on a project using react-redux-firebase, which has worked for me before. today I got the following error:

I'm not sure if the error is somewhere else in my code or if I have to update react-redux-firebase to version 3.., which doesn't seem to exist as of now. Has anyone else had this issue? I'd be grateful for any suggestions.

Here are the dependencies in my package.json:

"dependencies": { "firebase": "^5.7.0", "react": "^16.6.3", "react-dom": "^16.6.3", "react-redux": "^6.0.0", "react-redux-firebase": "^2.2.5", "react-router-dom": "^4.3.1", "react-scripts": "2.1.1", "redux": "^4.0.1", "redux-firestore": "^0.6.0", "redux-thunk": "^2.3.0" },

This is what my index.js file looks like:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { 
  createStore, 
  applyMiddleware, 
  compose 
} from 'redux';
import rootReducer from './store/reducers/index';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import { reduxFirestore, getFirestore } from 'redux-firestore';
import { reactReduxFirebase, getFirebase } from 'react-redux-firebase';
import fbConfig from './firebase/fbConfig';

const store = createStore(
  rootReducer,
  compose(
    applyMiddleware(
      thunk.withExtraArgument({
        getFirebase,
        getFirestore
      })),
      reduxFirestore(fbConfig),
      reactReduxFirebase(fbConfig)
  )
);

ReactDOM.render(<Provider store={store}><App /></Provider>, document.getElementById('root'));


serviceWorker.unregister();

回答1:


1- Download v3 as following:

npm i --save react-redux-firebase@latest

Then you can refactor your code to work with v3 as written here in the docs: https://github.com/prescottprue/react-redux-firebase/tree/next

2- Or just use react-redux v5.1.1

npm i --save react-redux@^5.0.0



回答2:


Just downgrade to react-redux@5.1.1 and react-redux-firebase@2.2.4 to fix this error. Using framework and boilerplate code in your app is a blessing and a curse at the same time.

Run these commands ....

npm -i react-redux@5.1.1
npm -i react-redux-firebase@2.2.4

Or these

npm i --save react-redux@5.1.1
npm i --save react-redux-firebase@2.2.4



回答3:


You can install v3 with npm i --save react-redux-firebase@next for now.

from http://docs.react-redux-firebase.com/history/v3.0.0/

Interested in support for react-redux@^6 or the new react context API? Checkout the next branch which contains the next upcoming major version (installed through npm i --save react-redux-firebase@next).




回答4:


Use this : npm install react-redux@5.1.1




回答5:


Running yarn add react-redux-firebase@next, and going through the documentation of firebase version3 helped me fix the issue. Here is the documentation




回答6:


After struggling quite a bit with learning this (in part due to an outdated course on Udemy) I found that npm i --s react-redux-firebase@latest was downloading 2.4.0.

npm i --s react-redux-firebase@next

The above did the trick and returned react-redux-firebase@3.0.0-alpha.16



来源:https://stackoverflow.com/questions/53872757/react-redux-v6-a-v3-version-of-react-redux-firebase-is-required

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!