title: React Native: Possible Unhandled Promise Rejection (id: 0): TypeError: undefined is not an object
body: <p>I have a React Native application that I cloned and after registering into the app on my simulator, I get this yellow error at the bottom of the screen which says:</p>
  
  <blockquote>
    <p>Possible Unhandled Promise Rejection (id: 0): TypeError: undefined is
    not an object (evaluating 'data.Items')</p>
  </blockquote>
  
  <p>I believe it has to be referencing one or all of these action creators in this file:</p>
  
  <pre><code>export function fetchPrefences({Key}) {
    return dispatch =&gt; {
      const url = `${endpoints.v2.INDIVIDUALS}/${Key}/preferences`;
      requester.sendGet(url).then(data =&gt; {
        const payload = helpers.sortPreferences(data);
        dispatch({
          type: types.SET_USER_PREFERENCES,
          payload,
        });
      });
    };
  }
  
  export function fetchTopics() {
    return dispatch =&gt; {
      requester.sendGet(endpoints.TOPICS_OF_CONCERN).then(data =&gt; {
        dispatch({
          type: types.SET_USER_TOPICS,
          payload: data.Items,
        });
      });
    };
  }
  
  export function handleUpdateTopics({topics, involved}, updateBoth = false) {
    return dispatch =&gt; {
      return requester
        .sendPut(endpoints.TOPICS_OF_CONCERN, {
          Items: topics,
        })
        .then(data =&gt; {
          dispatch({
            type: types.SET_USER_TOPICS,
            payload: data.Items,
          });
          if (updateBoth) {
            dispatch(handleUpdatePreferences({involved}));
          }
        });
    };
  }
  </code></pre>
  
  <p>I have written asynchronous action creators in the past, but I can't see what is wrong with these. Is it that <code>data</code> is undefined? If so, my question would be, how is this possible if in other areas of the application <code>data</code> is being used with no obvious errors?</p>