Modern React Patterns
This skill ensures the agent uses modern, performant, and clean patterns for React development.
Core Rules
- •Functional Components Only: No
classcomponents. - •Hooks: Use
useState,useEffect,useMemo,useCallbackappropriately. Custom hooks for reusable logic. - •Tailwind CSS v4:
- •Use utility classes for styling.
- •Avoid
@applyunless effectively creating a reusable component abstraction that cannot be a component itself. - •Use arbitrary values
w-[10px]sparingly; prefer theme tokens.
- •State Management:
- •Local state > Context > External Store (Zustand/Redux).
- •Don't lift state up unless necessary.
- •Performance:
- •Code splitting with
React.lazy. - •Avoid prop drilling (use Composition or Context).
- •Code splitting with
Anti-Patterns to Spot
- •
useEffectdependencies missing. - •Mutating state directly.
- •Deeply nested ternary operators in JSX.