怎么热重载应该在本机中起作用?

res*_*ode 6 react-native redux

Hot Reloading现已推出,但我遇到很多问题.

起初我module.hot.accept("../reducers", () => {在redux商店中有标准代码,但这导致了问题.评论完该代码后,我开始得到Cannot read property 'length' of undefined.

我创建了一个新项目react-native init test,每次更改文件时都会收到相同的错误.

ExceptionsManager.js:61 Cannot read property 'length' of undefined
Run Code Online (Sandbox Code Playgroud)

是否需要在项目中进行热重装工作?

更新

这仍然没有记录,造成的问题多于其价值.现在我正在使用redux-persist进行实时重新加载.

res*_*ode 5

Facebook终于记录了如何使用热重装或热模块更换。

https://facebook.github.io/react-native/blog/2016/03/24/introducing-hot-reloading.html

API与Webpack略有不同

if (module.hot) {
    module.hot.accept(() => {
        const nextRootReducer = require("../reducers").default;
        store.replaceReducer(nextRootReducer);
    });
}
Run Code Online (Sandbox Code Playgroud)