A minimal React on Rails implementation of HMR with React Hot Loader 3, Redux, React Router 4, CSS modules and Webpack 2
bundle install
cd client && yarn
foreman start
- visit localhost:3000 and change source code to check out HMR
- add
"react-hot-loader"
topackage.json
- use
es2015
preset, disablemodules
and add"react-hot-loader/babel"
plugin in.babelrc
- add
"react-hot-loader/patch"
,"webpack-dev-server/client?http://localhost:3500"
to webpackentry
before your source file (in the same chunk that contains your source file if you have multiple chunks) - add
new webpack.HotModuleReplacementPlugin()
to webpackplugins
- set up dev server with
hot: true
orhotOnly: true
- wrap elements in
AppContainer
fromreact-hot-loader
- create a render function with
reactDOM
and use it for initial rendering and inmodule.hot.accept