Returning promise from dispatch
<p>Here is my action:</p>

<pre><code>export function fetchNearbyUsers(user, position) {
  return (dispatch) =&gt; {
    const query = new Parse.Query(Parse.User);
    query.withinKilometers('location', createGeoPoint(position), 10);
    query.equalTo('gender', user.attributes.interest);
    query.notEqualTo('objectId', user.id);
    query.limit(15);
    return query.find().then((users) =&gt; {
      dispatch({ type: GET_NEARBYUSER_LIST, payload: users });
      return Promise.resolve();
    }).catch((error) =&gt; {

    });
  };
}
</code></pre>

<p>now the question is why does this return undefined, when i map my dispatch through connect.</p>

<pre><code>this.props.fetchNearbyUsers(this.props.user, this.props.location).then(() =&gt; {
  this.setState({ refreshing: false });
}).catch((error) =&gt; {

});

const mapDispatchToProps = dispatch =&gt; ({
  fetchNearbyUsers: (user, position) =&gt; {
    dispatch(fetchNearbyUsers(user, position));
  },
});
</code></pre>

<p>as to this returns the Promise when i am accessing the store through context:</p>

<pre><code>const { dispatch } = this.context.store;
this.setState({ refreshing: true });
dispatch(fetchNearbyUsers(this.props.user, this.props.location)).then(() =&gt; {
    this.setState({ refreshing: false });
 });
</code></pre>