正确的观点:
我正在使用Expo XDE with react-native来构建一个跨平台的移动应用程序 .
我想使用AsyncStorage(react-native中的“localstorage”替代)保存和检索几个变量 .
添加要存储和检索的代码片段后,
在构建JavaScript包时,Expo XDE显示以下错误:"await is a reserved word"
根据文档(https://facebook.github.io/react-native/docs/asyncstorage.html),我在访问AsyncStorage时使用"await" .
有任何想法吗?这只是与Expo XDE相关的问题吗?
谢谢!!
1 回答
包括
const username = await AsyncStorage.getItem();
在内的函数需要异步 .你可以这样做: