-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added next-redux-wrapper to example #1196
Conversation
examples/with-redux/pages/other.js
Outdated
import { reducer, initStore, startClock } from '../store' | ||
import wrapper from 'next-redux-wrapper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe call it withRedux
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name of the function could be any because it's a default export, it my code it does not even have a name :) but yes, makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
Awesome. Please explain in the README what |
Done, there's no magic -- it auto-creates store when getInitialProps is called and then passes it down to Provider, also automatically. On the client side it also takes care of using same store every time. |
Thank you @kirill-konshin ! cc @impronunciable |
Awesome sauce! I'll take a look |
Stupid question for @kirill-konshin and other experts here: How do I access the store outside of I am trying to call the dispatch method from within my
And my
However, when I run it, the browser throws an error on this line saying
Any workaround? |
Never mind, a simple |
First of all, thank for great software!
I have made it a bit easier for developers to integrate Redux with Next.js, basically, I reworked your example and made a package https://github.com/kirill-konshin/next-redux-wrapper that hides all the underlying complexity from end users.
I thought it would be a bad idea to drag
redux
-related dependencies to mainnext
package, that's why it's a separate package.The purpose of this PR: I have simplified the example using this component.