if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers').default
store.replaceReducer(nextReducer)
})
}
I don’t know what this code has to do with hot loading and redux, please explain it
typecho2017-06-26 10:55:03
This is so that the status of redux can continue to remain unchanged during the relevant code.
For example: after a count field in redux is operated, the value is 2. If you don’t write that code, the count will become the initial value after the page is hot updated. This is my impression.