React Native AsyncStorage getItem returns promise not value

前端 未结 2 1340
无人共我
无人共我 2021-02-14 15:32

I have a login form and I am able to post my the form values. After a successful POST request, I get authentication token returned from the API. I need to save this token for fu

2条回答
  •  名媛妹妹
    2021-02-14 16:10

    using Async/Await :

    async _getStorageValue(){
      var value = await AsyncStorage.getItem('ITEM_NAME')
      return value
    }
    

提交回复
热议问题