Hello friends, Recently when I was installing a NPM package for my react native project. It starts showing me a Error about await method. Now for me its easy to understand that whenever we would use await method syntax in a function then we should have to make the function ASYNC type. But for some of us who are beginner in react native that can be a problem. So I think let’s make tutorial on this topic. So in this tutorial we would learn about React Native Unexpected Reserved Word ‘await’ Error Solution.
Screenshot of Error :-
Contents in this project React Native Unexpected Reserved Word ‘await’ Error Solution :-
1. To solve the Await method error all we have to do is define the ASYNC keyword at function declaration time. See the code example below :-
1
2
3
4
5
6
7
|
const checkRN_Version = async () => {
const version = await checkVersion();
console.log(version);
}
|
In above code we are calling a function with await method with async method.