Keep components small and focused — each component should have a single responsibility. If a component file exceeds 150-200 lines, it likely needs splitting. Extract reusable logic into custom hooks and presentational elements into smaller components. Rules of Hooks Hooks must be called at the top level of a component — never inside conditions, loops, or nested functions. This is not a style preference; it is required for React's internal tracking to work correctly. Use useMemo and useCallback only for measurable performance problems, not preventively. Keys & State Management Always use stable, unique IDs from your data as key props in lists — never use array indices (they break on reorder, filter, or insert). Lift state up to the nearest common parent when siblings need shared data. For…
Key Takeaways
Keep components small and focused — one responsibility each.
Never use array index as key — use stable unique IDs from data.
Hooks must be called at the top level, never inside conditions.