Home > Mobile >  async await promisse error in react native , how to solve?
async await promisse error in react native , how to solve?

Time:10-07

Im getting the following error:

'await' has no effect on the type of this expression.ts

What I'm trying to call is call the api by the function loginuser() and then I want it to get the information that I stored after a sucessfull attempt of login. I'm using Async storage to store and to get this storage.

import { loginUser } from '../controller/userAction';
         ...
         JSX components 
            ...
    const loginHandle = async(userName,password) => async() => {      
      
      else{      
        try {
          await loginUser(
            userName,
            password,
            setShowLoader)

           signIn(userName,password);

        }catch (error) {
          console.log(error.message)
        }                         
      }      
  }

In my loginuser I call the API and store user information at my sign in I want to get the information that I stored before (because of this Im trying to use async/await).

CodePudding user response:

await is not a function, it's a operate and you use it something like this.

await loginUser(....)
await singUp(...)
  • Related