title: How to deal with navigating after a dispatch in react
body: <p>I am having trouble with <code>react-navigation</code> in that I can not find a way to go to navigate to a screen after the data has been placed into the <code>redux</code> store. I tried to do many things but to no avail, the problem keeps persisting. The problem is that the <code>redux</code> store will not have dispatched fast enough before the screen pops up and the screen then errors because certain parts of the json file do not exist. I am wondering if there is a certain to halt the navigation until after the store is updated with the necessary JSON file. </p>
  
  <p>This is the portion of my app where the problem occurs.</p>
  
  <pre><code>_onPress = () =&gt; {
      if (this.state.taxonA == "" || this.state.taxonB == "") {
        Alert.alert("One or more fields have been left empty.");
        return;
      }
      let url = V.sprintf(
        "http://timetree.igem.temple.edu/api/pairwise/%s/%s",
        this.state.taxonA,
        this.state.taxonB
      );
      const { fetchData } = this.props;
      fetchData(url);
      console.log("should have fetched");
      //while(this.props.response.isFetching == true){}
      this.props.navigation.navigate("Picker");
    };
  </code></pre>
  
  <p>this is the <code>fetchData</code> function</p>
  
  <pre><code>export const fetchData = url =&gt; {
    console.log("Should enter async dispatch");
    return async dispatch =&gt; {
      dispatch(fetchingRequest());
      try{
        let response = await fetch(url);
        let json = await response.json();
        let dispatchChecker = dispatch(fetchingSuccess(json));
        console.log("DISPATCH", dispatchChecker);
        console.log("JSON",json);
        console.log(JSON.stringify(json, null, 2));
      }catch(error){
        console.log("ERROR",error);
        dispatch(fetchingFailure(error));
      }
    };
  };
  </code></pre>
  
  <p>The output should be a transition from one screen to another screen. but instead the app will get a red screen with the statement <code>cannot read property of 'found_taxon_a' of null</code> where found_taxon_a is a object in the JSON file that is fetched.</p>