3 ms·
fetch() returns a promise, which is unwrapped using await. fetch's promise contains a response object, which has a json method, which returns a promise. con
by neoeldex 10y ago
fetch() returns a promise, which is unwrapped using await.
fetch's promise contains a response object, which has a json method, which returns a promise.
const responsePromise = fetch(https://api.github.com/orgs/facebook');
const response = await responsePromise;
const jsonPromise = response.json();
const json = await jsonPromise;