I’m trying to store and get data that I fetch from an API. The user is supposed to get a token on the login screen, and the token will be shown in an Alert dialog on home screen when the user press a button. But the token is not shown in the Alert dialog. the token is shown after I
Tag: asyncstorage
state is not getting updated for a new user in react native
My app has a test sheet, if a user passes the test he is shown a passing screen and then the state is saved using asyncstorage. But the problem here is, let’s say i have user A and user B and user A is currently logged in, he passed the test and the app shows him passing screen and the
Save different values on Async Storage React Native
I’m making an app in which I’m trying to save data in the local storage of the phone. I’m using async storage for that but when I try to save a different value with a different key it just updates. Need help, please. Below is my read and write code. }; }; Thank you and sorry for bothering you. Answer
Async Storage in React Native showing only first time saved data
I am trying to save data into async storage every time when data in redux store changes, But I am getting an error when I am trying to update user’s Name and saving it then I am able to see the changes when Application is open but when I close the application and open it again then it is showing
Parsing JSON object with AsyncStorage
I am basically trying to write and read a simple object. Writing: AsyncStorage.setItem(‘@Test’, JSON.stringify(newStudent)) Reading: console.log(JSON.parse(AsyncStorage.getItem(‘@Test’))) But im getting “Uncaught SyntaxError: Unexpected token o in JSON at position 1”. I Also tried console.log(AsyncStorage.getItem(‘@Test’).ID) But im getting “Undefined”. How can I parse the object? Answer There are two ways you can get your information from AsyncStorage First: Then you can simply
Possible Unhandled Promise Rejection (id:0) Warning
I am getting the following warning message when my AsyncStorage Item is empty “Possible Unhandled Promise Rejection (id:0)” So my question is: How can I handle a promise rejection? My code: Answer You need to catch the reject of the promise: