-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
State lost on Hot Reloading with Create-React-App #1940
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
Comments
This is not a problem, it’s intentional. |
😨 But Redux was created for hot reloading and time travelling (as you know, because you are the creator 😄 ). It's very useful (and a great idea!) because sometimes you need to have information in the state for manipulating the UI. Any solution? I love hot reloading and I love too create-react-app 😞 |
Right, but then it got crazy popular, and hot reloading was still somewhat flaky, and people blamed React and Redux for their broken complicated project configurations 😉 . I’d rather not ship an experimental feature here if people get an impression that it’s stable and then become disappointed.
Sure, you can use |
Thanks a lot @gaearon !!! I will check it tomorrow and I will update my project. |
@aaronplanell, there is a great video by ReactCasts that shows how to get HMR working. It shows the same method to get Redux state preserved (as shown in the above linked article), and also how to set it up in a way that will preserve component state and DOM. (Note however, that the latter requires Webpack changes, so an ejection from |
@indiesquidge , @aaronplanell : yeah, you actually use HMR without ejecting from CRA, you just need to use the "plain" HMR API rather than using React-Hot-Loader. I've got an example of that in my blog post at http://blog.isquaredsoftware.com/2016/11/practical-redux-part-3-project-planning-and-setup/ , and I have a bunch of other articles on HMR listed at https://github.com/markerikson/react-redux-links/blob/master/webpack-advanced-techniques.md#hot-module-replacement that might help explain what's going on. |
Thanks a lot both of you, @indiesquidge & @markerikson!!! I fixed it in september with a few lines:
Nevertheless, I will check all your links in my next Hackaton, hehehe. Best regards from Barcelona! PS: LocaleProvider is library of Ant Design and must be removed if you don't use it. |
Hello,
I have detected a problem. The state is lost on Hot Reloading with Create-React-App. For instance:
Step 1:
Step 2:
Step 3:
The state will be loss.
For more information: aaronplanell/todolist-react-redux-wcra#1
The text was updated successfully, but these errors were encountered: