.agents/skills/frontend-code-review/references/component-architecture.md
Use these rules for React component structure, ownership, state, props, effects, and module organization.
Flag:
Accept repeated TanStack Query calls in siblings when each component independently consumes the data. Cache deduplication is not a reason to hoist by itself.
Flag:
Prefer colocated components split by actual data and state needs.
Flag:
When existing components already own interaction logic, prefer reusing or extending them. If a refactor is necessary, preserve the old interaction contract and add or update focused tests for changed behavior.
Flag:
Props types for trivial one-off props where inline typing is clearer.Do not flag FC, React.FC, function declarations, arrow functions, named exports, or default exports by syntax alone. Report them only when the chosen form causes a concrete type, lifecycle, export, framework, or enforced package-contract defect.
Flag effects that:
If an effect remains, it must synchronize with a named external system: browser API, subscription, timer, analytics-on-visibility, non-React widget, or imperative DOM integration.
Flag:
Prefer render-time derivation. Keep true local state for user choices, transient input, controlled popups, and feature UI state that has no server source.
Flag:
Use Link for normal navigation. Use router APIs for mutation success, guarded redirects, command flows, or form submission side effects.