-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
Create with-redux-persist example #7375
Conversation
This commit will add in an example using redux persist so that you can persist redux state in your next app. We pass in the app component to the loading `PersistGate` value, so that we can render our page on on initial render and then redux persist will kick in and rehydrate aftewards. This was based on an example started by @ashwamegh
Stats from current PRClick to expand stats
Click to expand serverless stats
|
@lfades when you get a chance if you could let me know what you think that would be great! |
👋 @jrusso1020 thank your for the PR , I ran the example locally, and I don't know what should I expect, Once the page was ready I activated |
@lfades This is more just to have the infrastructure of redux-persist in the application and have the application still rendered our while you're waiting for the whole request to complete. If you wanted to you could retrieve the information from local storage yourself and use it right away(instead of waiting for it to be in redux and getting it from there), but redux-persist won't kick in and rehydrate the redux state until the initial request for the next application is complete. If that makes sense. An example of this that we are using currently is that we have an ecommerce shop that was originally written as a client side react.js application. We have now since started a Next.js application to SSR parts of our eccomerce shop to increase SEO and page load speeds. We have to do this in pieces though as it is a big project. The two applications need to be able to share state between them so that if you navigate between them we don't have to make more requests to get the current state we can just pass it through local storage persisted redux state. (the applications live on the same domain behind a HTTP Proxy) |
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.
@jrusso1020 Makes sense, thank you for the PR 💯
Stats from current PRClick to expand stats
Click to expand serverless stats
|
What does this PR do
This commit will add in an example using redux persist so that you
can persist redux state in your next app. We pass in the app component
to the loading
PersistGate
value, so that we can render our pageon initial render and then redux persist will kick in and rehydrate
afterwards.
This was based on an example started by https://github.com/ashwamegh #6932 and addresses this issue #6852
but that PR was never updated and merged in so I thought I would take a stab at making the change myself. If there is a better way of going about this let me know