As parent function does not support async. I need to make call without await and get return value
. As suggested on most of the posts, applied promise with then
and returning value. But it prints as "promise" instead of return "value".
Can you please share, how to achieve return value instead of promise.
code sandbox: https://codesandbox.io/s/await-without-async-and-return-value-qbs7t?file=/src/index.js
await isEnable(data) {
try {
...
return true;
}
catch (e) {
console.error(e);
}
}
}
const getEnableStatus=(data) =>{
return isEnable(data).then((result) =>
{console.log(result); return result;}); //this prints correctly but, need this in return result.
}
console.log(getEnableStatus(data)); //it always print 'promise'. how to get value here instead of promise.