Is it Possible to Access ctx in makeStore?
See original GitHub issueI read the source code and saw that ctx is unpacked into the options.
Sadly it seems like it is empty. Console logging the options gives me
I use next-redux-wrapper like this:
class MyApp extends App {
/* ... */
}
export default withRedux(makeStore, { debug: true })(MyApp);
Am I doing something wrong? For now I had to write my own Redux wrapper because I want to use redux-cookies-middleware and the getCookie/setCookie functions need ctx to work.
Issue Analytics
- State:
- Created 4 years ago
- Comments:30 (14 by maintainers)
Top Results From Across the Web
ERROR TypeError: makeStore is not a function - Stack Overflow
Not sure what the withRedux api is but based on the error it seems it's expecting a function but you are passing an...
Read more >Next.js — Setting up a Redux store with combineReducers()
Your Next server takes the currently store state after running getInitialProps() and call the makeStore() again to create a new store for components...
Read more >Next-redux-wrapper NPM
Although it is possible to create server or client specific logic in both createStore function and getInitialProps method I highly don't recommend to...
Read more >Server-Side Rendered App with Next.js, React and Redux
To get started with next , we need to edit our package.json in ... When using it on normal pages, getInitialProps only has...
Read more >Next Js React Redux Authentication Tutorial - Kaloraat
This way pages will be able to access redux store as props. ... While inside _app you can destructure Component, router and ctx(context)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Req has cookies in headers. You may add cookie-parser middleware.
@oyeanuj The only “right” way to do it I found was to do it in makeStore like this:
Note the comment, it is important or you’ll introduce a hard to find bug. It’s probably even better not to do it at all, see here.