CodePark/ questions / Rendering strategies
START PRACTICINGPRACTICE
Frontend question · Next.js › Rendering strategies

A statically rendered page uses a Client Component that calls useSearchParams(). What should you do?

Wrap that component in a <Suspense> boundary

Wrapping that component in a <Suspense> boundary is correct. Search params are unknown at build time, so this component must render on the client. Without a Suspense boundary, everything up to the nearest boundary is rendered on the client, and production builds report a missing Suspense boundary error. The tempting "Nothing; the search params are known at build time" is wrong: a static build cannot know what query string a visitor will use.