Data fetched using Saga not showing
Arjun-Aggarwal opened this issue · 2 comments
Arjun-Aggarwal commented
I have created a simple Next.js app. I am trying to fetch data in getInitialProps of the index page, storing the data in the store, and then accessing it with the Index component via connect. The data is being correctly fetched and stored into the store; however, I am not receiving the data in the Index component. No error is showing up either.
My code is available at https://github.com/Arjun-Aggarwal/next-trial.
Where have I gone wrong in my code?
bbortt commented
Youre createStore
arguments in redux/store.js
are in the wrong order.. you forgot to include initialState
;)
- const store = createStore(reducer, applyMiddleware(sagaMiddleware))
+ const store = createStore(reducer, initialState, applyMiddleware(sagaMiddleware))
Like this the updated state (by any reducer) will never reach your store..
Arjun-Aggarwal commented
Thanks a lot