question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS/React Hot Reloading

See original GitHub issue

I think one of the best parts of something like this is that typically complex things to setup like hot reloading just work out of the box. It brings those advanced workflows to everyone.

Hot reloading is such a crucial part of my dev experience, and this project could expose it to others. The only problem is that React hot reloading doesn’t work all the time, so I don’t know if that is too confusing to beginners.

I haven’t looked at how this project actually works yet, but I can’t think of any reason why this wouldn’t work. Just automatically include webpack-hot-middleware in dev mode, add the right entry point, add the right babel transform, etc. It can be completely hidden from the user.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:42
  • Comments:29 (12 by maintainers)

github_iconTop GitHub Comments

41reactions
asbjornengecommented, Jan 25, 2017

What? React hot-reloading is like the main reason I would want (and need) this tool 😲

31reactions
Scimonstercommented, Feb 9, 2017

It seems it’s actually very simple to add HMR for React to your app. See https://medium.com/@sheepsteak/adding-hot-module-reloading-to-create-react-app-e053fadf569d#.fxu5lgi3z. It’s literally an extra 10 lines of code.

Before:

ReactDOM.render(
    (
        <Provider store={store}>
            <App />
        </Provider>
    ),
    document.getElementById('root')
);

After:

function render(Component) {
    ReactDOM.render(
        (
            <Provider store={store}>
                <Component />
            </Provider>
        ),
        document.getElementById('root')
    );
}

render(App);

if (module.hot) {
    module.hot.accept('./App', () => {
        const NextApp = require('./App').default;
        render(NextApp);
    });
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Hot reload is not working with CSS modules, starting in 3.1.0
I'm on react-scripts 3.3.0-next.62 , and SCSS Modules changes trigger a full reload instead of hot-reloading like before. I jumped from 2.1.5 ...
Read more >
Set up React Hot Loader in 10 minutes
We can see the HMR's hot reloading in action by adding a basic style to the index.css file that's included out of the...
Read more >
Hot Reload only for css? - reactjs
In a new create-react-app, hot reloading seems to be taking effect only for css files. In the simple example below, clicking on the...
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 >
Hot Module Replacement
Hot Module Replacement with CSS is actually fairly straightforward with the help of the style-loader . This loader uses module.hot.accept behind the scenes...
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found