Which fix removes the bug?
async function load() {
const res = fetch('/api/data');
return res.json();
}
- Await the fetch call
- Return the promise
- Mark json() as async
- Add a catch handler
Without await,
Play Problem Solving ▸
res is a Promise and has no json method.