Reputation: 301
I apologize for opening this post - I know there are others. I've probably tried 20 different combinations of setup from other posts and I can't get past it. Any help would be GREATLY appreciated.
I am getting this error:
configureStore2.default.firestore is not a function
actions file:
import firebase from '../store/configureStore';
.....
export const setTweets = (tweets) => ({
type: 'SET_TWEETS',
tweets
});
export const startSetTweets = () => {
return (dispatch, getState) => {
const uid = getState().auth.uid;
console.log("uid = ", uid);
const postsRef = firebase
.firestore() // <---- this line causes the error
.collection("posts");
from configureStore
import firebase from 'firebase/app';
import 'firebase/auth'
import 'firebase/firestore'
..........
firebase.initializeApp(firebaseConfig)
firebase.firestore().settings({ timestampsInSnapshots: true })
.......
export { googleAuthProvider, firebase, store as default}
from package.json
"firebase": "^8.1.1",
"redux": "3.7.2",
"redux-firestore": "0.14.0",
Upvotes: 0
Views: 31
Reputation: 6313
You seem to be importing the default export from configureStore
which is store
but it looks like you want firebase
instead.
If that's the case use import { firebase } from '../store/configureStore';
in your actions file.
So your code would like this this:
import { firebase } from '../store/configureStore';
// .....
export const setTweets = (tweets) => ({
type: 'SET_TWEETS',
tweets
});
export const startSetTweets = () => {
return (dispatch, getState) => {
const uid = getState().auth.uid;
console.log("uid = ", uid);
const postsRef = firebase
.firestore()
.collection("posts");
Read more about named exports here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
Upvotes: 1