Created
June 30, 2017 16:21
-
-
Save mtheoryx/cd974cb4bd8fb371c827211787eb2d1f to your computer and use it in GitHub Desktop.
Create React App with HMR (Hot Module Replacement)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import './index.css'; | |
| import App from './App'; | |
| import registerServiceWorker from './registerServiceWorker'; | |
| ReactDOM.render(<App />, document.getElementById('root')); | |
| registerServiceWorker(); | |
| // Enable HMR | |
| if (module.hot) { | |
| module.hot.accept('./App', () => { | |
| ReactDOM.render(<App />, document.getElementById('root')); | |
| }) | |
| } | |
| //Using Redux | |
| // import { createStore } from 'redux' | |
| // | |
| // import rootReducer from './reducers' | |
| // | |
| // const configureStore = () => { | |
| // const store = createStore(rootReducer) | |
| // | |
| // if (process.env.NODE_ENV !== "production") { | |
| // if (module.hot) { | |
| // module.hot.accept('./reducers', () => { | |
| // store.replaceReducer(rootReducer) | |
| // }) | |
| // } | |
| // } | |
| // | |
| // return store | |
| // } | |
| // | |
| // export default configureStore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment