Only top-level component hot reloads
See original GitHub issueETA: This issue actually does involve React Router, after all. Please see my comment further down the thread.
Previously:
I’m using 3.0.0-beta.1.
I originally thought the problem was with React Router but I’m updating the description to reflect what my problem actually is. React Router is fine.
Hot module reloading works for my root component and for any lower level components defined within the same module. However, hot module loading doesn’t seem to propagate down the import tree. Lower level components defined in separate files end up triggering the warning message, The following modules couldn't be hot updated: (They would need a full reload!).
Not sure what I’m doing wrong. Here’s how I’m telling webpack to re-render.
if (module.hot) {
module.hot.accept('./root', () => {
const NextRoot = require('./root').default;
render(
<AppContainer>
<NextRoot {...{ store, history, onUpdate, routes }} />
</AppContainer>,
document.getElementById('app')
);
});
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:24 (8 by maintainers)
Top Results From Across the Web
Getting Started · React Hot Loader - Dan gaearon
Note: react-hot-loader/webpack only works on exported components, whereas react-hot-loader/babel picks up all top-level variables in your files.
Read more >Hot Reloading in React - Medium
React Hot Loader was my first popular open source project and, to my knowledge, the first tool that allowed you to edit React...
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 ... again and wrap the app's top-level component inside of...
Read more >Component not reloaded with react hot loader - Stack Overflow
I should've specified in my answer that two instances of webpack-dev-server were running before and now there's only one. You should be all...
Read more >How to Hot-Load React Component in 7 days. Part 2(React)
Step 1 — React Hot Loader ... So, just after configuring HMR you have to add one new dependency to your project to...
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

Sorry, copy-pasting and setting up a project is really tedious to validate bug reports 😄 Can you please provide this on GitHub?
@benwiley4000 yes, whenever I switch the Route’s component from a stateless function to a class-based component the hot reload works, but when I switch it back to a stateless functional component the hot reload fails. (Tried across several routes/components)…it may have nothing to do with the Router, but rather something about stateless components, perhaps…like I mentioned I haven’t dived too deep into this issue, just sharing my observations.