Skip to content
Advertisement

React Native – Variable does not update correctly when retrieving data from AsyncStorage

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 reload(not refresh the app. I used Live Server extension) the screen three times.

Login.js

JavaScript

Home.js [UPDATE]

JavaScript

Advertisement

Answer

i hope it works

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement