Next.js · Senior · Question 25 of 75

Why can't generateStaticParams return an empty array with Cache Components?

Explanation

The build renders the route with sample params and checks that cookies(), headers() and other request data sit inside Suspense. Without samples, validation is impossible, so it's a build error. You can return a placeholder and handle it with notFound(), but that weakens the check.

Further reading

Problem with a question

Next.js · Senior · question 25

Test yourself

Take the Next.js · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz