yarn add -D react-hot-loader @hot-loader/react-dom
// webpack.config.js
entry: ['react-hot-loader/patch', './src'],
resolve: {
alias: {
'react-dom': '@hot-loader/react-dom',
},
},
// .babelrc
{
"plugins": ["react-hot-loader/babel"]
}
// App.tsx
import { hot } from 'react-hot-loader/root';
const App = () => <div>Hello World!</div>;
export default hot(App);