Closed Dhanushreddy09 closed 4 years ago
import {createStore,combineReducers,compose} from 'redux' import firebase from 'firebase' import 'firebase/firestore' import {reactReduxFirebase,firebaseReducer} from 'react-redux-firebase' import {reduxFirestore,firestoreReducer} from 'redux-firestore' //Reducers //@todo const firebaseConfig={ apiKey: "AIzaSyB-pyEKd5G3XqLokxcYsa66UsG8a_y0gMA", authDomain: "reactclientpanel-27246.firebaseapp.com", databaseURL: "https://reactclientpanel-27246.firebaseio.com", projectId: "reactclientpanel-27246", storageBucket: "reactclientpanel-27246.appspot.com", messagingSenderId: "466401447116" }; //react-redux-firebase-config const rrfConfig = { userProfile: 'users', useFirestoreForProfile: true } //init firebase instance firebase.initializeApp(firebaseConfig); //init firestore const firestore=firebase.firestore();
const createStoreWithFirebase=compose( reactReduxFirebase(firebase,rrfConfig), reduxFirestore(firebase) )(createStore) // Add firebase to reducers const rootReducer = combineReducers({ firebase: firebaseReducer, firestore: firestoreReducer }) //create initial state const initialState = {} //create store const store = createStoreWithFirebase(rootReducer, initialState,compose(reactReduxFirebase(firebase), window.REDUX_DEVTOOLS_EXTENSION && window.REDUX_DEVTOOLS_EXTENSION() ))
export default store;
i am getting object is not a function error.could you guys please solve!:)
reactReduxFirebase is no longer part of the API in v3, there is instead the ReactReduxFirebaseProvider. Make sure you follow the use section of the README
reactReduxFirebase
ReactReduxFirebaseProvider
import {createStore,combineReducers,compose} from 'redux' import firebase from 'firebase' import 'firebase/firestore' import {reactReduxFirebase,firebaseReducer} from 'react-redux-firebase' import {reduxFirestore,firestoreReducer} from 'redux-firestore' //Reducers //@todo const firebaseConfig={ apiKey: "AIzaSyB-pyEKd5G3XqLokxcYsa66UsG8a_y0gMA", authDomain: "reactclientpanel-27246.firebaseapp.com", databaseURL: "https://reactclientpanel-27246.firebaseio.com", projectId: "reactclientpanel-27246", storageBucket: "reactclientpanel-27246.appspot.com", messagingSenderId: "466401447116" }; //react-redux-firebase-config const rrfConfig = { userProfile: 'users', useFirestoreForProfile: true } //init firebase instance firebase.initializeApp(firebaseConfig); //init firestore const firestore=firebase.firestore();
const createStoreWithFirebase=compose( reactReduxFirebase(firebase,rrfConfig), reduxFirestore(firebase) )(createStore) // Add firebase to reducers const rootReducer = combineReducers({ firebase: firebaseReducer, firestore: firestoreReducer }) //create initial state const initialState = {} //create store const store = createStoreWithFirebase(rootReducer, initialState,compose(reactReduxFirebase(firebase), window.REDUX_DEVTOOLS_EXTENSION && window.REDUX_DEVTOOLS_EXTENSION() ))
export default store;
i am getting object is not a function error.could you guys please solve!:)