Skip to content
Back to skills

React Hook Form

ASecurity

Performant, flexible forms with minimal re-renders using React Hook Form

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added October 26, 2026
developmenttypescriptgoreactnextjsfrontendperformance

Works with

  • cli

Security analysis

A100/100

Scanned October 26, 2026

npx -y skills add nhan03bit/ultrathink --skill react-hook-form --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of React Hook Form?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for React Hook Form
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nhan03bit-react-hook-form/badge)](https://www.skillsdirectory.com/skills/nhan03bit-react-hook-form)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: react-hook-form
description: Performant, flexible forms with minimal re-renders using React Hook Form
layer: domain
category: forms
triggers: ["react hook form", "useForm", "useFieldArray", "hookform", "rhf"]
inputs:
  - form_requirements: Fields, validation rules, submission behavior
  - ui_library: Controlled components in use (Select, DatePicker, etc.)
outputs:
  - form_implementation: useForm setup with validation and submission
  - schema: Zod schema with @hookform/resolvers integration
linksTo: [react, forms, zod, typescript-frontend]
linkedFrom: [forms, react, nextjs]
riskLevel: low
---
# React Hook Form

Performant, flexible forms with minimal re-renders. Embraces uncontrolled inputs by default and isolates component re-renders for optimal performance.

## When to Use
- Forms with 3+ fields where re-render performance matters
- Complex validation (async, cross-field, conditional)
- Dynamic fields (add/remove rows) or multi-step forms
- Integration with controlled UI libraries (Radix, MUI, Headless UI)

## Key Patterns

**useForm hook** -- `register`, `handleSubmit`, `watch`, `formState` (`errors`, `isSubmitting`, `isDirty`):
```ts
const { register, handleSubmit, watch, formState: { errors, isSubmitting } } = useForm<T>({
  resolver: zodResolver(schema), defaultValues: { ... },
  mode: 'onBlur', // onSubmit | onChange | onBlur | onTouched | all
});
```
**Zod integration** via `@hookform/resolvers`:
```ts
import { zodResolver } from '@hookform/resolvers/zod';
const form = useForm({ resolver: zodResolver(mySchema) }); // z.infer<typeof mySchema>
```
**Controller** for controlled components (Select, DatePicker, etc.):
```tsx
<Controller name="role" control={control} render={({ field }) => (
  <Select onValueChange={field.onChange} value={field.value}>{/* options */}</Select>
)} />
```
**useFieldArray** for dynamic fields:
```ts
const { fields, append, remove, move } = useFieldArray({ control, name: 'items' });
// fields.map((f, i) => <input key={f.id} {...register(`items.${i}.name`)} />)
```
**FormProvider + useFormContext** for form composition:
```tsx
<FormProvider {...methods}><StepOne /><StepTwo /></FormProvider>
// Child: const { register } = useFormContext<T>();
```
**Server actions** -- validate client-side with RHF, then call `useFormState(serverAction, init)` on success.

**DevTools** -- `import { DevTool } from '@hookform/devtools'` for a floating state inspector in dev.

## Anti-Patterns

| Anti-Pattern | Fix |
|---|---|
| `watch()` entire form | `watch('field')` or `useWatch` to limit re-renders |
| `register` on controlled components | Use `Controller` instead |
| Missing `key={field.id}` in useFieldArray | Always key by `field.id` |
| `mode: 'onChange'` by default | Use `onBlur` or `onTouched` |
| Recreating `defaultValues` each render | Memoize or define outside component |
| `setValue` in loops | Batch with `reset()` or `shouldValidate: false` |

## Related Skills
`react` -- `forms` -- `zod` -- `typescript-frontend`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.