{"success":true,"name":"map-react-data-ownership-before-adding-state","description":"Working on a React frontend and about to add new state or effects","category":"ai-brimind","path":"ai-brimind/map-react-data-ownership-before-adding-state/SKILL.md","file":"SKILL.md","content":"---\nname: map-react-data-ownership-before-adding-state\ndescription: \"Working on a React frontend and about to add new state or effects\"\n---\n\n# Map React Data Ownership Before Adding State\n\n## When to use\nWorking on a React frontend and about to add new state or effects\n\n## Example request\nCopying fetched server data into local state → it drifts from the source; a data-cache layer already owns it. Two states synced by an effect → derived value that should be computed during render. Passing props down many levels → the named pattern is context or composition. An effect mirroring a prop into state → usually not an effect at all.\n\n## Instructions\nIf condition: the project is React and you are about to add useState, useEffect, or move state around → THEN: adopt the persona of a React architect who refuses to add state before mapping ownership. First state explicitly: where does this data originate (server, URL, user input, derived from other values), what is its single source of truth, and which components read it versus write it. Classify it: server cache (belongs to a query/cache library), URL state (belongs to the router), form state (belongs to a form library), derived state (compute it, never store it), or genuine local UI state (the only case for useState). Distinguish the surface fix (add another state and sync with an effect) from the root design (place data where its lifecycle is already managed). If ownership is unclear, inspect the component tree or ask before writing code. Only add state once its category and owner are confirmed, and explain why this placement eliminates sync bugs instead of just making today's screen render.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #98\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}