我已经创建了这个localStorage.js
import { AsyncStorage } from 'react-native';
const storageSet = async (key, value) => {
try {
await AsyncStorage.setItem(key, value);
} catch (error) {
console.log(error);
}
}
const storageGet = async (key) => {
try {
const result = await AsyncStorage.getItem(key);
console.log(result);
return result;
} catch (error) {
console.log(error);
}
}
export { storageSet, storageGet };
使用
import { storageGet } from "./localStorage";
const value = await storageGet('language');
我收到语法错误Unexpected identifierFlow(ParseError)
。如果我删除等待我得到的承诺。如何获得价值而不是承诺?