I have a a object that when I'm printing that it's returning Promise <Pending>
(I've checked the type of getRateable
and it is object)
getRateable = getRateableEntitiesTx(tx, hashtagList);
I can't have access to the value by this :
getRateableEntitiesTx(tx, hashtagList).then((res) => {return res})
If it's a Promise
why it's not returning the res
properly?
Thanks in advance for help
You can't return the value from an async function because the function returns before the value has been received. That's why we have promises. You need to use the value from within the
then()
callback: