我尝试使用新的 ReactReduxFirebaseProvider 和 createFirestoreInstance 将我的项目从 react-redux-firebase v2 迁移到 v3
我的代码现在可以正常工作。但是升级到 react-redux-firebase v3 之后,就不是了。我收到此错误:
这是我的 index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { createStore, applyMiddleware, compose } from 'redux'
import rootReducer from './store/reducers/rootReducer'
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 './config/fbConfig'
const store = createStore(rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({getFirebase,
getFirestore})),
reactReduxFirebase(fbConfig), // redux binding for firebase
reduxFirestore(fbConfig) // redux bindings for firestore
)
);
ReactDOM.render(<Provider store={store}><App /></Provider>,
document.getElementById('root'));
registerServiceWorker();
我试图从他们自己的迁移指南中实现它:http ://react-redux-firebase.com/docs/v3-migration-guide.html#what-changed但我没有得到它......也许我还有很多东西要学。但是,如果有人能指出我正确的方向,那就太好了。
我试图更改代码但没有任何好的结果:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
import { createStore, applyMiddleware, compose } from 'redux'
import rootReducer from './store/reducers/rootReducer'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import { ReactReduxFirebaseProvider, getFirebase } from 'react-redux-firebase';
import { createFirestoreInstance, getFirestore } from 'redux-firestore'
import fbConfig from './config/fbConfig'
const store = createStore(rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({getFirebase, getFirestore})),
)
);
const rrfProps = {
firebase,
config: fbConfig,
dispatch: store.dispatch,
createFirestoreInstance
}
ReactDOM.render(
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<App />
</ReactReduxFirebaseProvider>
</Provider>, document.getElementById('root'));
registerServiceWorker();