react-app-rewire-hot-loader
Add the react-hot-loader
to your create-react-app
app via react-app-rewired
.
Because who wants their app, state, and styles automatically reloading all the time?
Installation
npm install --save react-app-rewire-hot-loader # If you don't already, you also need: npm install --save react-app-rewirednpm install --save react-hot-loader
Usage
- In the
config-overrides.js
of the root of your project you created forreact-app-rewired
add this code:
const rewireReactHotLoader = require('react-app-rewire-hot-loader') /* config-overrides.js */module.exports = function override (config, env) { config = rewireReactHotLoader(config, env) return config}
- Follow 'step 2' from https://github.com/gaearon/react-hot-loader , replicated below:
Mark your root component as hot-exported:// App.js const App = <div>Hello World!</div> envNODE_ENV === “development” ? App : App
- Replace 'react-scripts' with 'react-app-rewired' in package.json
"scripts": ,
That's it, you now have hot reloads!
License
Licensed under the MIT License, Copyright ©️ 2017 Chris Harris. See LICENSE.md for more information.