All quizzesHard
Next.js Expert — Series 3
Preview — 3 of 10 questions
What does "use cache" do here, and how do cacheTag / cacheLife relate to it?
javascript
async function getCatalog(region: string) {
'use cache';
cacheTag('catalog');
cacheLife('hours');
return db.products.findMany({ where: { region } });
}AIt marks the function as cacheable — Next.js caches the return value keyed by the function's serializable arguments (region), cacheLife('hours') sets the revalidation profile, and cacheTag('catalog') attaches a tag so revalidateTag('catalog') can purge it
BIt forces the function to run on the Edge runtime
CIt disables caching for the function, overriding the default
DIt is an alias for React.cache() and only dedupes within one render
With the dynamicIO experimental flag enabled, this page errors at build unless changed. What is the model?
javascript
export default async function Page() {
const user = await getUser(); // uncached, per-request
return <Profile user={user} />;
}AdynamicIO disables all data fetching in Server Components
BUnder dynamicIO, any uncached async data access must be wrapped in <Suspense> (or live inside a "use cache" boundary). Data is either explicitly cached, or explicitly dynamic-behind-Suspense — there is no implicit "the whole route just becomes dynamic" fallback
CdynamicIO makes every route fully static and ignores cookies()
DIt only affects Route Handlers, not pages
Which props are valid to pass from a Server Component to a Client Component?
javascript
// Server Component
<ClientChart
data={rows}
formatter={(n) => n.toFixed(2)}
onLoad={handleLoad}
createdAt={new Date()}
/>AAll of them — Next.js serializes anything
BOnly strings and numbers; objects and arrays throw
Cdata (plain serializable values), createdAt (a Date, which the RSC serializer supports along with Map, Set, BigInt, typed arrays, and Promises) are fine; formatter and onLoad are functions and throw — the only functions that may cross are Server Actions (functions marked "use server")
DFunctions are fine but Date objects are not
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.