При интеграции firebase и firestore с помощью response я столкнулся с этой ошибкой.
Я следил за новой документацией response-redux-firebase, но это не помогает.
Ошибка -> TypeError: firestore.collection не является функцией
Это функция, при которой я получаю ошибку
Код
export const addProductFamily = (productFamilyDetails) => {
return (dispatch, getState, { getFirestore }) => {
console.log("product family details ", productFamilyDetails);
const firestore = getFirestore();
console.log("firestore is ", firestore);
firestore
.collection("productFamilyDetails") <------------ error
.add({
...productFamilyDetails,
})
};
};
Это это файл App. js, в котором я установил все конфигурации
App. js
import { Provider } from "react-redux";
import { createStore, applyMiddleware, combineReducers, compose } from "redux";
import thunk from "redux-thunk";
import authReducer from "./store/reducers/auth";
import {
ReactReduxFirebaseProvider,
firebaseReducer,
getFirebase,
} from "react-redux-firebase";
import {
createFirestoreInstance,
firestoreReducer,
getFirestore,
reduxFirestore,
} from "redux-firestore";
import { firebaseConfig } from "./config/fbConfig";
import firebase from "firebase/app";
const rrfConfig = { userProfile: "users", useFirestoreForProfile: true };
const rootReducer = combineReducers({
auth: authReducer,
firebase: firebaseReducer,
firestore: firestoreReducer,
});
const store = createStore(
rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
reduxFirestore(firebaseConfig, firebase)
)
);
const rrfProps = {
firebase,
config: rrfConfig,
dispatch: store.dispatch,
createFirestoreInstance,
};
ReactDOM.render(
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<BrowserRouter>
{/* <App /> */}
<Layout />
</BrowserRouter>
</ReactReduxFirebaseProvider>
</Provider>,
document.getElementById("root")
);
Я удалил ненужный импорт