.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:
React.FC / FC.Props types for trivial one-off props where inline typing is clearer.Prefer top-level function declarations for components and module helpers. Use arrow functions for callbacks and local lambdas.
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.