title: Get item from AsyncStorage in React Native
body: <p>I have a list of companies in React Native. </p>
  
  <p>When I click on one of those companies I get the url of the API that is used for selected company. Then I store it to <code>AsyncStorage</code> and then I show the login screen. The function is as follows:</p>
  
  <pre><code>selectCompany(data_url, e) {
      AsyncStorage.setItem("data_url", JSON.stringify(data_url), () =&gt; this.props.login());
  }
  </code></pre>
  
  <p>Then on login page if I click on <code>sign in</code> button I go to the <code>onLogin</code> function, the function is as follows:</p>
  
  <pre><code>onLogin: function() {  
    fetch(data.url + '/manager/api/v1/obtain-auth-token/', })
      .then(function(body) {
      return body.json();
    }).then(function(json) {
      .....
    }).catch(function() {
      ....
    });
  },
  </code></pre>
  
  <p>And <code>data.url</code> comes from <code>data.js</code> file, and I try to get <code>url</code> from the data.js file  as follows:</p>
  
  <pre><code>let data_url = AsyncStorage.getItem("data_url").then(json =&gt; JSON.parse(json));
  module.exports = {
  
      url: data_url,
      .....
  }
  </code></pre>
  
  <p>But it doesn't work. Any advice?</p>