react-typescript
/react-typescript
Type React components and hooks with TypeScript patterns. Use when typing React props, hooks, event handlers, or component generics in TypeScript.
- Author
- HoangNguyen0403 ↗
- Repository
- agent-skills-standard ↗
- Licence
- MIT
- Last repository change
- 22.10.2026
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Type React components and hooks with TypeScript patterns. Use when typing React props, hooks, event handlers, or component generics in TypeScript.
Original author description
Type React components and hooks with TypeScript patterns. Use when typing React props, hooks, event handlers, or component generics in TypeScript.
How it works
- Priority: P1 (HIGH)
- Implementation Guidelines
- Anti-Patterns
- References
- Canonical response anchors
SKILL.md preview
---
name: react-typescript
description: Type React components and hooks with TypeScript patterns. Use when typing React props, hooks, event handlers, or component generics in TypeScript.
metadata:
triggers:
files:
- '**/*.tsx'
keywords:
- ReactNode
- FC
- PropsWithChildren
- ComponentProps
- react typescript
- tsx types
- props interface
- generic component
- useState type
- useRef type
- typed hooks
---
# 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
- **No `any`**: Use `unknown`.
- **No `React.FC`**: Implicit children deprecated/bad practice.
- **No `Function`**: Use `(args: T) => void`.
## References
See [references/example.md](references/example.md) for typed props, generic components, and hook ref patterns.
## Canonical response anchors
When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- generic
Files in this package (3)
- SKILL.md 2 KB
- evals/evals.json 2 KB
- references/example.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · HoangNguyen0403/agent-skills-standard | 100 | MIT |
| sudeeppatgar/fullstack-skills | 100 | MIT |
| yvssdheeraj/opencode-engineering-harness | 90 | MIT |
Database snapshot: 13.11.2026 · package version 293e821d1828 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 96react-dev
This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned. Covers type-safe patterns for React 18-19 including generic components, proper event typing, and routing… - 100typescript-react-patterns
TypeScript best practices for React development. Use when writing typed React components, hooks, events, refs, or generic components. Triggers on tasks involving TypeScript errors, type definitions, props typing, or type-safe React patterns. - 100react-component-generator
Generate React components with TypeScript, proper props, hooks, and accessibility. Use when creating new React components, UI elements, or refactoring existing components. - 95component-patterns
Implement React component patterns including composition, custom hooks, render props, HOCs, and compound components. Use when building reusable React components, implementing design patterns, or refactoring component architecture. - 95typescript-react-nextjs-patterns
Production-grade TypeScript reference for React & Next.js frontend development. Covers type narrowing, component Props, generic hooks, discriminated unions, as const, satisfies, Zod validation, TanStack Query, server/client boundaries, forms, state management, performance,… - 100react
Core React 19 patterns including hooks, Suspense, lazy loading, component structure, TypeScript best practices, and performance optimization. Use when working with React components, hooks, lazy loading, Suspense boundaries, or React-specific TypeScript patterns.