When to use
- 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.
React TypeScript
On-demand loading: Read files from references/ and examples/ only when specific guidance is needed for the current step.
Type-safe React = compile-time guarantees = confident refactoring.
- Building typed React components
- Implementing generic components
- Typing event handlers, forms, refs
- Using React 19 features (Actions, Server Components, use())
- Router integration (TanStack Router, React Router)
- Custom hooks with proper typing
NOT for: non-React TypeScript, vanilla JS React
Key breaking changes — see react-19-patterns.md for full migration checklist:
- ref as prop:
forwardRef deprecated; pass ref as a regular prop
- useActionState: replaces
useFormState from react-dom
- use(): unwraps promises/context, triggers Suspense when unresolved
- useOptimistic: optimistic UI updates during async transitions
Key typing patterns — see references for full examples:
- Props: extend native elements with
ComponentPropsWithoutRef<'button'>
- Children: use
ReactNode (renderable), ReactElement (single element), render props for callbacks
- Discriminated unions: model variant props with
| { variant: 'link'; href: string }
Use specific event types (not any) for accurate currentTarget typing:
- Mouse:
React.MouseEvent<HTMLButtonElement>
- Form submit:
React.FormEvent<HTMLFormElement>
- Input change:
React.ChangeEvent<HTMLInputElement>
- Keyboard:
React.KeyboardEvent<HTMLInputElement>
See event-handlers.md for focus, drag, clipboard, touch, wheel events.
Key patterns — see hooks.md for useCallback, useMemo, useImperativeHandle:
- useState: explicit type for unions/null —
useState<User | null>(null)
- useRef:
null initial for DOM refs; non-null for mutable values
- useReducer: discriminated union action types for exhaustive handling
- Custom hooks: return
[value, fn] as const for correct tuple inference
- useContext: null guard + throw pattern for required context consumers
Generic components infer types from props — no manual annotations at call site.
- Use
keyof T for column/field keys; render props for custom cell rendering
- Constrain with
T extends HasId when a required base shape is needed
See generic-components.md for Table, Select, List, Modal, FormField patterns.
React 19 Server Components run on server, can be async — see server-components.md:
- Async RSC:
async function Page() fetches directly, no useEffect
- Server Actions:
'use server' directive, call revalidatePath after mutations
- Client + Action:
useActionState(serverAction, initialState) wires form to action
- use() handoff: pass
Promise from server to client; use() suspends until resolved
Both TanStack Router and React Router v7 provide type-safe routing:
- TanStack Router: compile-time safety, Zod
validateSearch, file-based route tree
- React Router v7: auto-generated
+types/ from loaders/actions, Framework Mode
See tanstack-router.md and react-router.md.
ALWAYS:
- Specific event types (MouseEvent, ChangeEvent, etc)
- Explicit useState for unions/null
- ComponentPropsWithoutRef for native element extension
- Discriminated unions for variant props
- as const for tuple returns
- ref as prop in React 19 (no forwardRef)
- useActionState for form actions
- Type-safe routing patterns (see routing section)
NEVER:
- any for event handlers
- JSX.Element for children (use ReactNode)
- forwardRef in React 19+
- useFormState (deprecated)
- Forget null handling for DOM refs
- Mix Server/Client components in same file
- Await promises when passing to use()
- hooks.md - useState, useRef, useReducer, useContext, custom hooks
- event-handlers.md - all event types, generic handlers
- react-19-patterns.md - useActionState, use(), useOptimistic, migration
- generic-components.md - Table, Select, List, Modal patterns
- server-components.md - async components, Server Actions, streaming
- tanstack-router.md - TanStack Router typed routes, search params, navigation
- react-router.md - React Router v7 loaders, actions, type generation, forms
Source: kscius/KS-Cursor-Orchestrator — distributed by TomeVault.
1---2name: react-dev-53description: 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 integration (TanStack Router, React Router). Use when this capability is needed.4---56## When to use78- 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.910# React TypeScript1112> **On-demand loading**: Read files from `references/` and `examples/` only when specific guidance is needed for the current step.1314Type-safe React = compile-time guarantees = confident refactoring.1516<when_to_use>1718- Building typed React components19- Implementing generic components20- Typing event handlers, forms, refs21- Using React 19 features (Actions, Server Components, use())22- Router integration (TanStack Router, React Router)23- Custom hooks with proper typing2425NOT for: non-React TypeScript, vanilla JS React2627</when_to_use>2829<react_19_changes>3031Key breaking changes — see [react-19-patterns.md](references/react-19-patterns.md) for full migration checklist:32- **ref as prop**: `forwardRef` deprecated; pass `ref` as a regular prop33- **useActionState**: replaces `useFormState` from react-dom34- **use()**: unwraps promises/context, triggers Suspense when unresolved35- **useOptimistic**: optimistic UI updates during async transitions3637</react_19_changes>3839<component_patterns>4041Key typing patterns — see references for full examples:42- **Props**: extend native elements with `ComponentPropsWithoutRef<'button'>`43- **Children**: use `ReactNode` (renderable), `ReactElement` (single element), render props for callbacks44- **Discriminated unions**: model variant props with `| { variant: 'link'; href: string }`4546</component_patterns>4748<event_handlers>4950Use specific event types (not `any`) for accurate `currentTarget` typing:51- Mouse: `React.MouseEvent<HTMLButtonElement>`52- Form submit: `React.FormEvent<HTMLFormElement>`53- Input change: `React.ChangeEvent<HTMLInputElement>`54- Keyboard: `React.KeyboardEvent<HTMLInputElement>`5556See [event-handlers.md](references/event-handlers.md) for focus, drag, clipboard, touch, wheel events.5758</event_handlers>5960<hooks_typing>6162Key patterns — see [hooks.md](references/hooks.md) for useCallback, useMemo, useImperativeHandle:63- **useState**: explicit type for unions/null — `useState<User | null>(null)`64- **useRef**: `null` initial for DOM refs; non-null for mutable values65- **useReducer**: discriminated union action types for exhaustive handling66- **Custom hooks**: return `[value, fn] as const` for correct tuple inference67- **useContext**: null guard + throw pattern for required context consumers6869</hooks_typing>7071<generic_components>7273Generic components infer types from props — no manual annotations at call site.74- Use `keyof T` for column/field keys; render props for custom cell rendering75- Constrain with `T extends HasId` when a required base shape is needed7677See [generic-components.md](examples/generic-components.md) for Table, Select, List, Modal, FormField patterns.7879</generic_components>8081<server_components>8283React 19 Server Components run on server, can be async — see [server-components.md](examples/server-components.md):84- **Async RSC**: `async function Page()` fetches directly, no useEffect85- **Server Actions**: `'use server'` directive, call `revalidatePath` after mutations86- **Client + Action**: `useActionState(serverAction, initialState)` wires form to action87- **use() handoff**: pass `Promise` from server to client; `use()` suspends until resolved8889</server_components>9091<routing>9293Both TanStack Router and React Router v7 provide type-safe routing:94- **TanStack Router**: compile-time safety, Zod `validateSearch`, file-based route tree95- **React Router v7**: auto-generated `+types/` from loaders/actions, Framework Mode9697See [tanstack-router.md](references/tanstack-router.md) and [react-router.md](references/react-router.md).9899</routing>100101<rules>102103ALWAYS:104- Specific event types (MouseEvent, ChangeEvent, etc)105- Explicit useState for unions/null106- ComponentPropsWithoutRef for native element extension107- Discriminated unions for variant props108- as const for tuple returns109- ref as prop in React 19 (no forwardRef)110- useActionState for form actions111- Type-safe routing patterns (see routing section)112113NEVER:114- any for event handlers115- JSX.Element for children (use ReactNode)116- forwardRef in React 19+117- useFormState (deprecated)118- Forget null handling for DOM refs119- Mix Server/Client components in same file120- Await promises when passing to use()121122</rules>123124<references>125126- [hooks.md](references/hooks.md) - useState, useRef, useReducer, useContext, custom hooks127- [event-handlers.md](references/event-handlers.md) - all event types, generic handlers128- [react-19-patterns.md](references/react-19-patterns.md) - useActionState, use(), useOptimistic, migration129- [generic-components.md](examples/generic-components.md) - Table, Select, List, Modal patterns130- [server-components.md](examples/server-components.md) - async components, Server Actions, streaming131- [tanstack-router.md](references/tanstack-router.md) - TanStack Router typed routes, search params, navigation132- [react-router.md](references/react-router.md) - React Router v7 loaders, actions, type generation, forms133134</references>135136---137> Source: [kscius/KS-Cursor-Orchestrator](https://github.com/kscius/KS-Cursor-Orchestrator) — distributed by [TomeVault](https://tomevault.io).138<!-- tomevault:4.0:skill_md:2026-06-15 -->