I use AsyncStorage in my React Native app to store user information. The getItem() function is asynchronous and requires me to call back when I want to load data from the storage system.
AsyncStorage.getItem("phoneNumber").then((value) => { this.setState({"phoneNumber": value}); }).done();
Since it takes a little time to retrieve the value from the repository, I would like to wait for the operation to complete before continuing.
Is it possible to load data in a way that is not asynchronous? If not, is there an easy way to wait for the getItem() call to complete getItem() continuing?
source share