You can utilize fetch from WHATWG, and combine with async from ES 2107.
fetch
WHATWG
async
ES 2107
🕷 epsi-rns.gitlab.io/code/2020/10/25...
Also,
const data = await fetch(url).then(r => r.json())
if you don't need to catch response.ok (i.e. statusCode >= 200 && statusCode < 300).
response.ok
statusCode >= 200 && statusCode < 300
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can utilize
fetch
fromWHATWG
, and combine withasync
fromES 2107
.🕷 epsi-rns.gitlab.io/code/2020/10/25...
Also,
if you don't need to catch
response.ok
(i.e.statusCode >= 200 && statusCode < 300
).