title: How to get a value from local storage with asyncStorage and return it
body: <p>I want to create a method that returns an auth header from a token stored in the local storage so it can be called from many ajax, like this:</p>
  <pre><code>const fetchUserInfo = (username) =&gt; {
    const requestString = apiBaseURL + 'access/user_info/'
    const form = {username: username}
  
    return axios.post(requestString, form, getAuthHeader())
      .then((Response) =&gt; {
        return {
          userInfo: Response.data,
          message: null
        }
      })
      .catch((Error) =&gt; {
        return getErrorMessage();
      });
  }
  </code></pre>
  <p>In this case, <code>getAuthHeader()</code> is a method that must return a proper authorization header from a token stored in the local storage, so it must use <code>asyncStorage</code> in order to retrieve such token.</p>
  <p>This is the code for <code>getAuthHeader</code>:</p>
  <pre><code>export const getAuthHeader = async () =&gt; {
    return await AsyncStorage.getItem('token')
      .then ((token) =&gt; {
        return {
          headers: {'Authorization' : 'Token ' + token}
        }
      })
      .catch ((error) =&gt; null)
  }
  </code></pre>
  <p>The problem is that <code>getAuthHeader()</code> is not returning a header but some other object. I believe I am messing up with the asynchronous nature of <code>asyncStorage</code>, but I can't figure out how to get the value I need.</p>