react-typescript

Installation
SKILL.md

React TypeScript

Priority: P1 (HIGH)

Implementation Guidelines

  • Components: Prefer interface/type (Props) over React.FC (which implicit children). Use JSX.Element or ReactNode as return type.
  • Children: For components that accept children, use PropsWithChildren<T> or explicitly type them as React.ReactNode.
  • Events: Always type event handlers using specific React events, such as React.ChangeEvent<HTMLInputElement> or React.FormEvent<HTMLFormElement>.
  • Hooks: For useRef, avoid any; use useRef<HTMLDivElement>(null). For useState, use generics for complex types: useState<User | null>(null).
  • Native Elements: Use ComponentPropsWithoutRef<'button'> or ComponentPropsWithRef to extend native attributes safely.
  • Generics: Implement generic components for reusable UI like lists using <T,>(props: ListProps<T>).
  • Discriminated Unions: Use Discriminated Unions for mutually exclusive props (e.g., success vs error states).
  • Utility Types: Leverage Omit, Pick, and Partial to transform prop interfaces and avoid redundancy.

Anti-Patterns

Installs
2
GitHub Stars
561
First Seen
Jul 21, 2026
react-typescript — hoangnguyen0403/agent-skills-standard