Question presented to candidate: "You have a product page that needs the product, its reviews and the current user. Show me how you would load that data in the App Router, and tell me what you would watch out for."
What a strong answer should cover:
- A Server Component can be
asyncand simplyawaitdata:fetch, an ORM, a file read, an SDK call. - No
useEffect, no API route in between, and no loading state for the initial HTML. - Independent requests should run in parallel with
Promise.all, or be split into separate components under Suspense so they stream. - Identical
fetchGET calls in one render are memoized, andReact.cachedoes the same for non-fetch functions, so you can load data where it is used. - Whether the result is cached across requests is a separate decision (fetch options, 'use cache'), and request-time data makes the route dynamic.
Clarifying questions expected:
- "Do the three requests depend on each other?" β only dependent ones should be sequential.
- "Is any of this data per user?" β it decides between caching and rendering per request.
Code / implementation expected: Yes β an async Server Component with parallel requests and a streamed part.