我正在try 将数据保存在react-native
中的AsyncStorage
中.我想用async
和await
关键字异步保存它.
async onPositiveClickListener = () => {
// user has completed product tour_end
try {
await AsyncStorage.setItem("@ProductTour:key", "true");
const { navigate } = this.props.navigation;
navigate("DashboardScreen");
} catch (error) {
console.log(error);
}
};
我在保存程序时出错
SyntaxError: Unexpected token, expected ( (40:32)
38 | };
39 |
> 40 | async onPositiveClickListener = () => {
| ^
41 | // save user has completed product tour_end
42 | try {
43 | await AsyncStorage.setItem("@ProductTour:key", "true");
Hide Stack Trace
SyntaxError: Unexpected token, expected ( (40:32)
38 | };
39 |
> 40 | async onPositiveClickListener = () => {
| ^
41 | // save user has completed product tour_end
42 | try {