Y
Hacker News
new
|
ask
|
show
|
jobs
by
tracker1
312 days ago
It isn't, the following works fine...
var data = await fetch(url).then(r => r.json());
Understanding Promises/A (thenables) and async/await can sometimes be difficult or confusing, especially when mixing the two like above.
1 comments
mcv
309 days ago
Same thing. Maybe this doesn't make the double promise quite as visible, but it's still a double promise. You could probably replace the other await with a .then() too.
link