FlashcardNot attempted
State localization rules
Recall it before you reveal
In a Next.js app, how do you decide where a piece of state lives?
Space to reveal
Show answer & explanation
1. Server first: if it can be computed on the server from the request (params, cookies, DB), don't make it state at all. 2. URL for anything that changes what is displayed and should be shareable (filters, tabs, pagination). 3. Local component state for UI-only interaction (open/closed, input drafts), at the lowest component that needs it. 4. Context in the root layout only for truly global, interactive state (cart, auth, theme).