Rules Include
Components
- Functional components only (no class components)
- Props interfaces (not
type) with descriptive names React.FCavoided — use explicit return types- Component files: one component per file, named exports
Hooks
- Custom hooks for shared logic (prefix with
use) useMemo/useCallbackonly for measured performance issuesuseReducerfor complex state,useStatefor simple
TypeScript
- Strict mode enabled
- Discriminated unions for component variants
- Generic components when type flexibility needed
as constfor literal types
Testing
- React Testing Library (not Enzyme)
- Test behavior, not implementation
userEventoverfireEvent