6

Hot Reloading is out now but I am having lots of problems getting it to work.

At first I had the standard module.hot.accept("../reducers", () => { code in my redux store but that was causing problems. After commenting that code out I started getting Cannot read property 'length' of undefined.

I created a new project react-native init test and I get the same error every time a file is changed.

ExceptionsManager.js:61 Cannot read property 'length' of undefined

Is there something that needs to be done in the project to make hot reloading work?

Update

This is still undocumented and causing more problems than its worth. For now I am using redux-persist with live reloading.

1
  • Did you ever find a fix to this problem? It's happening with my project as well. When I save a new bit of code it will then say cannot read property length of undefined Commented Apr 28, 2016 at 7:05

1 Answer 1

6

Facebook has finally documented how to use Hot Reloading or Hot Module Replacement.

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

The api is slightly different than Webpack

if (module.hot) {
    module.hot.accept(() => {
        const nextRootReducer = require("../reducers").default;
        store.replaceReducer(nextRootReducer);
    });
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.