gaearon / gaearon/react-hot-loader

Confused by docs: do I need module.hot.accept(... after export default hot(module)(App)?

Open
#1,150 20 comments 10 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
775
PR merge metrics
No merged PRs in 30d

Description

```js
// package.json
"react-dom": "npm:@hot-loader/react-dom", // do I need this?
```

```js
// webpack.config.js
module.exports = {
entry: [
'react-hot-loader/patch', // do I need this?
'./src/entrypoint.js'
],
// ...
```

```js
// babel.config.js
module.exports = {
plugins: ['react-hot-loader/babel'], // do I need this?
// ...
```

```js
// App.js
import { hot } from 'react-hot-loader/root';
import * as React from 'react';

const App = () =>

Hello World!
;

export default hot(App); // do I need this?
```

```js
// entrypoint.js
import React from 'react';
import ReactDOM from 'react-dom';

import { AppContainer } from 'react-hot-loader'; // do I need this?
import App from './App';

const render = Component => {
ReactDOM.render(


,
document.getElementById('root');
);
};

render();

// do I need this?
module.hot.accept('./App.js', () => {
const NextApp = require('./App.js').default;
render();
});

```

Is there an up-to-date full example of rendering a hot-exported component?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.