prescottprue / redux-firestore

Redux bindings for Firestore
MIT License
575 stars 102 forks source link

ReduxFirestoreProvider - Warning: Failed prop type: The prop `dispatch` is marked as required in `FirestoreConnect(Connect(Container))`, but its value is `undefined` #175

Open MWandtke opened 5 years ago

MWandtke commented 5 years ago

Hey guys,

I just started a new project with firebase and wanted to use the newest version of react-redux-firebase. I am using the firestore in my project, so the documentation says that I have to use the ReduxFirestoreProvider like:

`import React from 'react' import { render } from 'react-dom' import { Provider } from 'react-redux' import firebase from 'firebase/app' import 'firebase/auth' import 'firebase/firestore' // <- needed if using firestore import { createStore, combineReducers } from 'redux' import { firebaseReducer, ReduxFirestoreProvider, ReactReduxFirebaseProvider } from 'react-redux-firebase' import { createFirestoreInstance, firestoreReducer } from 'redux-firestore' // <- needed if using firestore import Todos from './App/Component/Todos'

const firebaseConfig = {apiKey: "xxx", authDomain: "xxx", databaseURL: "xxx", projectId: "xxx", storageBucket: "xxx", messagingSenderId: "xxx"}

// react-redux-firebase config const rrfConfig = { userProfile: 'users', useFirestoreForProfile: true // Firestore for Profile instead of Realtime DB }

// Initialize firebase instance firebase.initializeApp(firebaseConfig)

// Initialize other services on firebase instance firebase.firestore() // <- needed if using firestore

// Add firebase to reducers const rootReducer = combineReducers({ firebase: firebaseReducer, firestore: firestoreReducer // <- needed if using firestore })

// Create store with reducers and initial state const initialState = {} const store = createStore(rootReducer, initialState)

const rrfProps = { firebase, config: rrfConfig, dispatch: store.dispatch, createFirestoreInstance // <- needed if using firestore }

// Setup react-redux so that connect HOC can be used const App = () => (

);

render(, document.getElementById('root'));`

But with that config I got the error: Failed prop type: The prop 'dispatch' is marked as required in 'FirestoreConnectWrapped(Connect(Todos))', but its value is 'undefined'.

It is very similar to the issue. Am I doing something wrong or is there something to fix? I just followed this link

thanks

prescottprue commented 5 years ago

What version of react-redux-firebase are you running? Make sure to be on v3.0.0-alpha.6 or newer.

MWandtke commented 5 years ago

I do but now I am using ReactReduxFirebaseProvider and it's working. The documentation says you could use either one but I am not sure

ianitsky commented 5 years ago

Same issue here. Worked with ReactReduxFirebaseProvider

Using: "react": "^16.8.6", "redux": "^4.0.1", "redux-firestore": "^0.8.0", "react-redux-firebase": "^3.0.0-alpha.12",