Send asynchronous browser requests with fetch, XMLHttpRequest, JSON, errors, and progressive UI.
Lessons
Run several requests at once and wait for all.
Parallel Requests with Promise.all is easiest to learn by reading the example, changing it, and observing the result.
// Run several requests in parallel and wait for all
const [lessons, user] = await Promise.all([
fetch('/api/lessons').then(r => r.json()),
fetch('/api/user').then(r => r.json())
]);
console.log(lessons.length, user.name);Practice the Parallel Requests with Promise.all example in a small scratch file, then explain what changed and why.