React Native: menu.isDisconnected undefined is not an object

Hey @emmad! Congrats on getting over that first hurdle! You’re almost there :slight_smile: Thanks for posting this on Github. Loved your first commit message “I dont really know what im doing” lol classic! Skip to the bottom for the solution: I got your App working. :smiley:

First of all, I’d 100% would echo what @eric.kim said about not following that old tutorial. Just from a quick look, it’s super outdated. RN literally changes every month, with a 3yr old tutorial you’re bound to run into errors. It’s also a bit overkill for a Starter App. Redux on a starter app - way too much. That being said, Redux was your culprit and I have the solution for you below!

These red screens of death will soon become your best friend as a RN developer. Notice the error says “menu.isDisconnected” is “undefined”. This basically tells you what’s happening in detail. It literally means, “hey, I can’t find this menu.isDisconnected function you want me to run”.

When you attempt to run the “disconnect” action, you’re trying to dispatch something that is unknown to your app. You make it known by linking up the reducer (what tells your Redux based App what to actually do) when the action is dispatched.

Solution

  1. Open reducer/index.js

  2. Link up ‘menu’ in the combinedReducers method as follows:

    import { combineReducers } from ‘redux’;
    import login from ‘./loginReducer’;
    import menu from ‘./menuReducer’;

    export default combineReducers({
    login,
    menu
    });

  3. Run the app and you’re golden!

Happy coding :metal:

2 Likes