React本机异步存储


import AsyncStorage from '@react-native-async-storage/async-storage';

我正在使用上述软件包。两个小时前还很好。但突然停止工作。没有任何问题或警告。

我在我的应用程序中使用Aysncstorge来保存一个值。它运行良好。她是我的密码。

const Authorize = dispatch => async () =>{
console.log("calledddd")
try{
let islogin = await  AsyncStorage.getItem('islogin')
console.log(islogin)
}catch(error){
console.log(error)
}
console.log("called last")
}

我也这样试过。

AsyncStorage.getItem('islogin').then((islogin) => {
console.log(islogin)
}).catch((error) => {
console.log(error)
})

从以下包中使用它:

@react-native-community/async-storage

享受吧!!!

最新更新