awaiting a non promise function or method — Generally we use async/await with promises.
Let’s see this with an example: const fetch = ()=> {
return new Promise(function(resolve) {
setTimeout(()=> {
resolve('Done');
}, 3000);
});
}
async function getList() {
const data = await fetch();
console.log(data);
}
In above code fetch is returning a promise which will be…