title: React Native AsyncStorage returns promise even used await and async
body: <p>I researched the problem in AsyncStorage.getItem. Many of comment said we should apply <strong>await</strong> and <strong>anync</strong> on AsyncStorage, such as </p>
  
  <p><a href="https://stackoverflow.com/questions/42843305/react-native-asyncstorage-returns-promise-instead-of-value/42843802?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">React Native AsyncStorage returns promise instead of value</a>. </p>
  
  <p><a href="https://stackoverflow.com/questions/47916507/asyncstorage-getitem-returning-promise?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">AsyncStorage.getItem returning promise</a></p>
  
  <p>However, it still return Promise to me like the snapshot below. Inside this Promise, <strong>_55</strong> contained correct user information. Would every people help me figure out the problem and give me possible solution? Thank You! </p>
  
  <p>Snapshot:
  <a href="https://i.stack.imgur.com/4ji9i.png" rel="nofollow noreferrer">Debugger snapshot</a></p>
  
  <p>Reducer: </p>
  
  <pre><code>import {AsyncStorage} from "react-native";
  import {LOGIN, LOGOUT, UPDATE} from './../actions/authActions'
  import user from "./index";
  
  export type State = {
      user: Object,
      login: boolean,
  }
  
  getUser = async (string) =&gt; {  //Get user information form AsyncStorage
      try {
           return await AsyncStorage.getItem(string)
                    .then((user) =&gt; {
                       if (user !== null) {
                          return JSON.parse(user);
                       } else {
                          return null;
                     }
                  });
      } catch (error) {
          return null;
      }
  };
  
  const initialState = {
      info: getUser(),
      login: !!this.info, // if not null, login = ture
  };
  
  function loginReducer(state: State = initialState, action) {
      switch (action.type) {
          case LOGIN:
              return {
                  info: action.payload,
                  login: true,
              };
          case LOGOUT:
              return {
                  info: null,
                  login: false,
              };
          case UPDATE:
              return {...state, info: Object.assign(state.info, action.payload)};
          default:
              return state;
      }
  }   
  </code></pre>
  
  <p>Action: </p>
  
  <pre><code>import {AsyncStorage} from "react-native";
  import {requestLogIn, requestLogOut} from "../../config/api/authApi"
  
  export const LOGIN = "LOGIN";
  export const LOGOUT = "LOGOUT";
  export const UPDATE = "UPDATE";
  export const ERROR = "ERROR";
  
  export function login(user) {
      return dispatch =&gt; {
          return AsyncStorage.setItem("user", JSON.stringify(user)) //Store user information in AsyncStorage
              .then(() =&gt; {
                  dispatch({
                      type: LOGIN,
                      payload: user
                  })
              }).catch((error) =&gt; {
                  console.warn("Error: ", error);
                  dispatch({
                      type: ERROR,
                      payload: null
                  })
              });
      }
  }
  
  export function logout(token) { //
      return dispatch =&gt; {
          return requestLogOut(token).then((status) =&gt; {
              if (status) {
                  return AsyncStorage.removeItem("user")
                      .then(() =&gt; {
                          dispatch({
                              type: LOGOUT,
                          })
                      }).catch(() =&gt; {
                          dispatch({
                              type: ERROR,
                              payload: null
                          });
                      });
              } else {
                  dispatch({
                      type: ERROR,
                      payload: null
                  });
              }
          })
  
      }
  } ..// other actions
  </code></pre>