Reputation: 2053
I have not been able to get async/await working in a react native project.
const async getUser = () => {
try{
let value = await AsyncStorage.getItem("user");
return value;
}
catch(e){
throw e
}
}
I always get an Unexpected token error. I have tried adding { "presets": ["react-native", "es2015", "babel-preset-stage-3"] }
with the same result.
On version ^0.35.0
Upvotes: 0
Views: 139
Reputation: 35890
The syntax for async
arrow functions is:
const getUser = async () => {
...
}
Upvotes: 3