Error using async/await in React Native
When trying to use async/await in react-native, I am getting the following error: uncaught error Error: SyntaxError: /Users/senthilsivanath/Documents/MusicTulip/index.ios.js: Unexpected token (50:23) 48 | renderScene: function(route,nav) { 49 | try { 50 | const response = await signIn.isLoggedIn(); My .babelrc file is: { "presets": ["react-native", "es2015", "babel-preset-stage-3"] }
You might just be missing the async keyword on line 48. Update your code to use the async keyword before the function keyword: renderScene: async function(route, nav) { try { const response = await signIn.isLoggedIn(); // ... Or when using an arrow function, put the async keyword before the parameter list: renderScene: async (route, nav) => { try { const response = await signIn.isLoggedIn(); In JavaScript, the async keyword is a decorator that warns the runtime that...