Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Return the value of a promise [duplicate]

$
0
0

Is there a way that we can return the value from a promise? I have this async/await function meant to retrieve the token from another async/await function getToken() but it only returns a promise string to me. However, it does return the intended value in console log. What would be the best workaround for me to access the value itself and not a promise string like in the picture below?

const retToken = async(): Promise<any> => {  const value = await getToken();  console.log('value: ', value);  return value;}console.log('retToken: ', retToken());

console log results


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>