Recall & Review
beginner
What is the parallel data fetching pattern in Next.js?
It is a way to fetch multiple data sources at the same time instead of one after another, making the app load faster.
Click to reveal answer
beginner
Which JavaScript feature helps implement parallel data fetching in Next.js?
Promise.all lets you run multiple fetch requests at once and wait for all to finish together.
Click to reveal answer
beginner
Why is parallel data fetching better than sequential fetching?
Because it reduces total waiting time by fetching data at the same time, improving user experience.
Click to reveal answer
intermediate
How do you handle errors when using Promise.all for parallel fetching?
If one fetch fails, Promise.all rejects. You can use Promise.allSettled to handle each result separately.
Click to reveal answer
intermediate
Show a simple example of parallel data fetching in Next.js using Promise.all.
In an async function, use: const [data1, data2] = await Promise.all([fetch(url1).then(r => r.json()), fetch(url2).then(r => r.json())]);Click to reveal answer
What does Promise.all do in parallel data fetching?
✗ Incorrect
Promise.all runs all promises in parallel and waits until all are resolved or one fails.
Which Next.js feature is commonly used for server-side data fetching?
✗ Incorrect
getServerSideProps runs on the server and is used to fetch data before rendering.
What happens if one fetch fails inside Promise.all?
✗ Incorrect
Promise.all rejects as soon as one promise rejects.
Which method allows handling each fetch result separately even if some fail?
✗ Incorrect
Promise.allSettled returns results for all promises, whether fulfilled or rejected.
Why use parallel data fetching in Next.js?
✗ Incorrect
Parallel fetching improves performance by loading data at the same time.
Explain how you would fetch two APIs in parallel in Next.js and why this is beneficial.
Think about how waiting for one fetch then the other slows things down.
You got /3 concepts.
Describe how error handling differs between Promise.all and Promise.allSettled in parallel data fetching.
Consider what happens if one request fails among many.
You got /3 concepts.