javascript - A piece of code for react hot loading
漂亮男人
漂亮男人 2017-06-26 10:53:03
0
1
792
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

漂亮男人
漂亮男人

reply all(1)
typecho

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!