Closed und3fined closed 7 years ago
Now it work. You can clone the repo and test. I change
import App from './App';
const rootEl = document.getElementById('root');
const render = (Component: any) => {
ReactDOM.render(<AppContainer><Component /></AppContainer>, rootEl)
};
render(App);
if (module.hot) {
module.hot.accept('./App', () => render(App))
}
to
import App from './App';
const rootEl = document.getElementById('root');
const render = (Component: any) => {
ReactDOM.render(<AppContainer><Component /></AppContainer>, rootEl)
};
render(App);
if (module.hot) {
module.hot.accept('./App', () => {
// I do not know why!
// if without this line, the hot reload not work!!!
// no document for this issue.
const NextApp = require("./App").default;
// You can use 'App' or 'NextApp'
render(NextApp);
});
}
Could be related to https://github.com/gaearon/react-hot-loader/issues/514#issuecomment-288482049
Description
I've converted your code to run features HMR, but not work. I get full browser logs.
Screen 1
Screen 2
Screen 3
Environment
React Hot Loader version: "react-hot-loader": "next",
Run these commands in the project folder and fill in their results:
node -v
: v6.10.0npm -v
: v3.10.10yarn --version
: v0.21.3Then, specify:
Reproducible Demo
My repo: https://github.com/und3fined/react-hot-ts