I am transferring to react-redux-firebase 3.x I am studying react with this tutorial. https://github.com/ayush221b/MarioPlan-react-redux-firebase-app
How should I migrate the following codes?
index.js
const store = createStore(rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({getFirebase,getFirestore})),
reduxFirestore(fbConfig),
reactReduxFirebase(fbConfig, {useFirestoreForProfile: true, userProfile: 'users', attachAuthIsReady: true})
)
);
I found this document. https://react-redux-firebase.com/docs/v3-migration-guide.html I am rebuilding the project while referencing. However , I faced some issues. I don't know where this firebase comes from. Is fffConfig a common firebase-config?
reactReduxFirebase(firebase, rrfConfig)
fbconfig.js
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "1:12345:web:12345",
measurementId: "G-6MGBT"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.firestore();
export default firebase;
https://github.com/ayush221b/MarioPlan-react-redux-firebase-app/blob/master/src/index.js
The code I modified
const rrfConfig = {
userProfile: 'users',
useFirestoreForProfile: true, // Firestore for Profile instead of Realtime DB
attachAuthIsReady: true
}
const rrfProps = {
fbConfig,
config: rrfConfig,
dispatch: store.dispatch,
createFirestoreInstance // <- needed if using firestore
}
ReactDOM.render(
<React.StrictMode>
<Provider store = {store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<App />
</ReactReduxFirebaseProvider>
</Provider>
</React.StrictMode>
,document.getElementById('root')
The error
TypeError: Cannot read property '_' of undefined
createFirebaseInstance
src/createFirebaseInstance.js:38
35 | }
36 |
37 | // Add internal variables to firebase instance
> 38 | const defaultInternals = {
| ^ 39 | watchers: {},
40 | listeners: {},
41 | callbacks: {},