Check out example codes for "async await cacurios animal". It will help you in understanding the concepts better.

Code Example 1

// Verifying a user with async/await
const verifyUser = async function(username, password){
   try {
       const userInfo = await dataBase.verifyUser(username, password);
       const rolesInfo = await dataBase.getRoles(userInfo);
       const logStatus = await dataBase.logAccess(userInfo);
       return userInfo;
   }catch (e){
       //handle errors as needed

// Here we use the same `database.verifyUser`, `database.getRoles`
// and `database.logAccess` implementation based on promises

Learn ReactJs, React Native from