title: Async helper functions with AsyncStorage in React Native
body: <p>What I am trying to do is alert the <code>company_id</code> that is in local storage. </p>
  
  <pre><code>import React, { Component } from 'react';
  import { ActivityIndicator, AsyncStorage, Button, StatusBar, Text, StyleSheet, View, } from 'react-native';
  import * as pouchDB_helper from '../utils/pouchdb';
  
  type Props = {};
  export default class HomeScreen extends Component&lt;Props&gt; {
  
    render() {
  
      AsyncStorage.getItem('company_id', (err, result) =&gt; {
        alert(result);
      });
  
      return (
        &lt;View style={styles.container}&gt;
          &lt;Button title="Hi" onPress={this.doSomething} /&gt;
        &lt;/View&gt;
      );
    }
  
  }
  </code></pre>
  
  <p>The following code works but I want to be able to do it from inside a helper function. If you see at the top, I have <code>import * as pouchDB_helper from '../utils/pouchdb';</code></p>
  
  <p>In there I have the following:</p>
  
  <pre><code>import React from 'react';
  import { AsyncStorage } from 'react-native';
  import PouchDB from 'pouchdb-react-native'
  
  
  export async function pouchDB_config() {
    return AsyncStorage.getItem('company_id', (err, result) =&gt; {
        return result;
      });
  }
  </code></pre>
  
  <p>Instead of <code>AsyncStorage.getItem()</code> code, if I do <code>alert(pouchDB_helper.pouchDB_config())</code> I get an object with the following: <code>{"_40":0,"_65":0,"_55"_null,"72":null}</code></p>
  
  <p>I know I'm obviously not doing something right with the whole asynchronous nature of it all so if anyone has any guidance I would greatly appreciate it. I'm still not up to par with how to work with async functions in react native.</p>