Right to the point:
I'm using Expo XDE with react-native to build a cross-platform mobile app.
I want to save and retrieve a couple of variables using AsyncStorage ("localstorage" alternative in react-native).
After adding the pieces of code to store and retrieve,

Expo XDE is showing the following error when building the JavaScript bundle: "await is a reserved word"

According to the documentation (https://facebook.github.io/react-native/docs/asyncstorage.html), I got to use "await" when accessing AsyncStorage.
Any ideas? Is it a problem related to Expo XDE only?
Thanks!!
To use await, your function including const username = await AsyncStorage.getItem(); needs to be async.
You can do like this :
async myfunction() {
...
const username = await AsyncStorage.getItem();
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With