Error using async/await in React Native Error using async/await in React Native javascript javascript

Error using async/await in React Native


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 the attached enclosure will use the await keyword, so you always see them used together. Which is why you will hear people refer to this syntax as the async/await syntax.

Simply put: You can't use await without async.

Edit: If you are declaring this inside of a class, then just be sure that your syntax is correct:

class MusicTulip extends Component {    async renderContent() {        const response = await signIn.isLoggedIn();    } }

Hope this helps!