title: Return the result value with fetch call function from another page, React native
body: <p>I need to return the result of a function from another page in react native which performing a fetch call. I use the method as follows. As I know this is because asynchronous call. Is there a special way to achieve this in react native ?  </p>
  
  <p><strong>fetchcall.js</strong></p>
  
  <pre><code>import address from '../actions/address'
  const dashboard = {
    getvals(){
  
      return fetch(address.dashboardStats(),
      {method: "POST",
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify( {...
        }),
      })
      .then((response) =&gt; response.json())
      .then((responseData) =&gt; {
        console.warn(responseData);
        return responseData;
  
      })
      .catch((error) =&gt; { console.warn(error); })
      .done();
      // return 'test_val'';
    }
  }
  
  export default dashboard;
  </code></pre>
  
  <p><strong>dashboard.js</strong></p>
  
  <pre><code>import dashboard from '../../services/dashboard';
  class Dashboard extends Component {
  
  
    componentDidMount(){
        console.warn(dashboard.getvals());
    }
  
  }
  
  export default connect(mapStateToProps, bindAction)(Dashboard);
  </code></pre>
  
  <p>Its display the result as "undefined", but that fetch call works and it displays the result. Any suggestion? </p>