Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 4 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

React Hook Form

Performant form state library using React Hooks with minimal rerenders.

Forms, validation and schemasNPM

GitHubWebsite

1. License

License from npm.

github.com/react-hook-form/react-hook-form

From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error

What React Hook Form does

React Hook Form is built around uncontrolled inputs: <code>register</code> captures the input's ref instead of wiring <code>value</code>/<code>onChange</code> through React state, and the maintainers present this as the way to cut re-renders while users type.

React Hook Form popularity

86 / 100
Gid Score, #23 overall
68.3M
downloads a week, npm
44.9K
GitHub stars
569
agent projects use it
React Hook Form: downloads per weeknpm, react-hook-form 68,283,187
React Hook Form: GitHub starsreact-hook-form/react-hook-form 44,926

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How React Hook Form is used

  • React Hook Form is a dependency in 569 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (11.7% of the 4,867 JavaScript/TypeScript ones), #2 of 63 in forms, validation and schemas.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 2,187; those are left out of every share on this page.
  • The most used alternative in our scan is TanStack Form (20 projects).
  • Projects that use it most often also use clsx (89.3%), Lucide React (88.4%), Tailwind Merge (88.4%).
  • It is more common in projects set up for Roo Code (16.2%) than for OpenCode (5.2%).

By coding agent

299 projects, 12.2%
271 projects, 8.3%
248 projects, 8.2%
39 projects, 14.0%
35 projects, 7.5%
31 projects, 6.5%
18 projects, 5.2%
18 projects, 16.2%

Often used with

In 89.3% of its projects
In 88.4% of its projects
In 88.4% of its projects
In 87.0% of its projects
In 83.8% of its projects
In 90.3% of its projects
In 100.0% of its projects
In 74.9% of its projects

React Hook Form in practice

Strengths

Controlled fields re-render alone

Most inputs stay uncontrolled. When a component has to be controlled, the FAQ says <code>Controller</code> or <code>useController</code> limits re-renders to that one field.

Per-input subscriptions

The site says you can subscribe to updates for a single input or for form state without re-rendering the entire form.

No dependencies

The maintainers describe it as "a tiny library without any dependencies." The README lists "Small size and no dependencies" among its features.

Schema validators through resolvers

The README says it supports Yup, Zod, AJV, Superstruct, Joi "and others", linking the separate resolvers repository.

Watch out for

Class components need a wrapper

The FAQ answers "No, not out of the box" for class components. Its suggestion is to build a wrapper around the hook and use that in the class component.

Setting <code>value</code> breaks typing

The FAQ ties the "first keystroke not working" problem to passing <code>value</code>. Use <code>defaultValue</code> per field or <code>defaultValues</code> on the form instead.

Sharing the ref takes extra wiring

The library needs the input's ref. If you also need a ref for focus or scrolling, the FAQ splits <code>ref</code> out of <code>register()</code> and passes the element to both in one callback.

Quickstart: register inputs and show errors

import { useForm } from 'react-hook-form';

function App() {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm();

  return (
    <form onSubmit={handleSubmit((data) => console.log(data))}>
      <input {...register('firstName')} />
      <input {...register('lastName', { required: true })} />
      {errors.lastName && <p>Last name is required.</p>}
      <input {...register('age', { pattern: /\d+/ })} />
      {errors.age && <p>Please enter a number for age.</p>}
      <input type="submit" />
    </form>
  );
}

More about React Hook Form

Funding
  • GitHub Sponsors: https://github.com/bluebill1049
  • GitHub Sponsors: https://github.com/jorisre
  • GitHub Sponsors: https://github.com/kotarella1110
  • Open Collective: https://opencollective.com/react-hook-form
  • Own page: https://youtube.com/@bluebill1049
  • 7 GitHub sponsors

See all

Agent Skills for it
  • react-hook-form: React Hook Form performance optimization for client-side form validation using useForm, useWatch, useController, useFieldArray, the subscrib

See all

Packages around it
  • zod: Schema validation
  • clsx: Conditional class names
  • lucide-react: Icons
  • tailwind-merge: Tailwind class merging
  • @hookform: Schema resolvers
  • class-variance-authority: Variant class names
More in Forms, validation and schemas

Alternatives

React Hook Form This page

MITGid 8668.3M/wk

TanStack Form

Type-safe form state management for React with validation and error handling.

MITGid 647.2M/wk

Formik

Popular React form state management library with validation and submission handling.

Apache-2.0Gid 666.4M/wk

Compare React Hook Form with another tool

Get started

Install it.

npm install react-hook-form

Rules for your agent

Paste into AGENTS.md or CLAUDE.md
## React Hook Form
- Wire native inputs with `{...register('name', rules)}`. Do not add `value`/`onChange` state: `register` captures the ref.
- Never pass `value` to a registered input. Initialize with `defaultValues` on `useForm`, or `defaultValue` per field.
- For async initial data, make `defaultValues` an async function, or pass fetched data as `values` with `resetOptions: { keepDirtyValues: true }`.
- Wrap components that must stay controlled in `Controller` or `useController`, so only that field re-renders.
- If you need your own ref, destructure `const { ref, ...rest } = register('x')` and pass the element to both RHF's `ref` and your own ref in one callback.
- To clear a form including errors, use RHF's `reset()`. `HTMLFormElement.reset()` only clears input/select/checkbox values.
- For accessible errors, set `aria-invalid` from `errors.field` and render the message in an element with `role="alert"`.