README
react-hmr
The AMD wrapper of react-hot-loader@next for react HMR
How to use
Install
npm install react-hmr --save-dev
Usage
DEV ENV
Preload
dist/react-hot-loader.dev.js
ordist/react-hot-loader.dev.min.js
compress versionUpdate your React app entry code:
- import/require
patch
andAppContainer
as the React.Component proxy, thepatch
should execute before the app startup - use the
AppContainer
component wrap your app root component
import patch from 'react-hot-loader/patch'; import AppContainer from 'react-hot-loader/lib/AppContainer'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; const store = { name: 'react' }; ReactDOM.render( <AppContainer> <App></App> </AppContainer>, document.getElementById('app') );
- import/require
PROD ENV
Like
DEV ENV
, except for preloaddist/react-hot-loader.prod.js
ordist/react-hot-loader.prod.min.js
compress version.
Reference
- react-hot-loader: the next version
- The next react-hot-loader upgrade example