Reputation: 714
I'm working on an example project integrating https://reactnavigation.org/ with Redux.
I have all the navigation stuff working and have set up an action inside my dashboard to get data from an API on fetch button click. https://github.com/starchand/SampleNavigation/blob/master/app/containers/dashboard/views/Dashboard.js
This is working - I am getting the data, however I am also getting an random action being executed before:
Any ideas whats causing the first action?
Full repo: https://github.com/starchand/SampleNavigation
Upvotes: 1
Views: 673
Reputation: 13916
Just by taking a quick look at your code, it seems to me the order of middleware you are applying to the store should be the reversed.
When you are doing this.props.fetchQuestions(1);
inside your Dashboard
component, you are dispatching a function (or thunk) instead of a plain object. Since redux-logger
is the first middleware in the chain, it's logging the function itself, with obviously undefined
action type. Reverting the order of middlewares should fix the problem.
Inside https://github.com/starchand/SampleNavigation/blob/master/app/store.js#L16 try:
return applyMiddleware(thunkMiddleware, logger())
Upvotes: 2