Full reloads with react-hot-loader/webpack
See original GitHub issueDescription
I tried using react-hot-loader/webpack
as described in the docs, because I’m not using babel in my setup. However, this way the hot reloading doesn’t work, it reloads the top level container losing the state of all nested components.
Expected behavior
It should work the same as in react-hot-loader/babel
mode - components are swapped without losing state.
Actual behavior
All state of all the components is lost upon reloading.
Environment
React Hot Loader version: 3.0.0-beta7
Reproducible Demo
To reproduce:
git clone git@github.com:KidkArolis/react-hot-boilerplate.git
git checkout webpack-loader-issue
npm install
npm start
open http://localhost:3000
vim src/Counter.js # and save, the counter resets, but it shouldn't
This is all I changed in the default react-hot-boilerplate
:
https://github.com/KidkArolis/react-hot-boilerplate/commit/c72df249e3b06586b8ec7fddb95174386a398b73
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Getting Started · React Hot Loader - Dan gaearon
React Hot Loader is a plugin that allows React components to be live reloaded without the loss of state. It works with Webpack...
Read more >GitHub - gaearon/react-hot-loader
GitHub - gaearon/react-hot-loader: Tweak React components in real time. ... Watch Dan Abramov's talk on Hot Reloading with Time Travel.
Read more >Webpack/react hot reload reloading whole page?
It works, and when I change a file (say, src/components/Note/Note.css ) the app does reload. However, I want to only reload the component,...
Read more >Set up React Hot Loader in 10 minutes - LogRocket Blog
A hot reload to an app will only refresh the files that were changed without losing the application's state. · A live reload...
Read more >Enabling hot reload in React web app | by Dong Chen - Medium
Hot reload allows developers to see result of code change in browser without page refresh. This greatly improves developer productivity and experience, ...
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 Free
Top 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
I have diffed the bundle.js produced in both modes and here is a comparison of individual module:
react-hot-loader/babel
react-hot-loader/webpack
About this issue, this is probably due to Webpack since you see a full reload. Also, Webpack plugin support is very limited (only module exports).