React Hook Form

Performant, flexible React forms built on hooks with minimal re-renders and built-in validation.

Library
npm
v7.89.0
44,864 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
92 /100 Excellent
Development Activity 100
Maintenance 100
Community 68
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
88 /100 Excellent
Architecture 90
Code Quality 90
Innovation 88
Learning Curve 85

React Hook Form is a form-state management library for React that uses uncontrolled inputs and refs instead of re-render-heavy controlled components, keeping form interactions fast even with large or deeply nested forms. It exposes a single useForm hook that returns registration helpers, submit handlers, and granular form-state subscriptions, so components only re-render when the specific field or state slice they subscribe to actually changes.

The library ships zero runtime dependencies, embraces native HTML constraint validation out of the box, and layers on optional schema-based validation through a resolvers package that adapts Zod, Yup, Joi, Superstruct, AJV, and others. Its API surface — register, handleSubmit, watch, useController, useFieldArray, useFormContext — has stayed stable across major versions, which combined with first-class TypeScript inference has made it the default forms library for a large share of the React ecosystem, including React Native projects.

What You Get

  • The useForm hook, providing register, handleSubmit, watch, reset, setValue, getValues, and a subscription-based formState object
  • useController and the Controller component for wrapping controlled/third-party UI inputs (MUI, Chakra, Ant Design, etc.) that can’t accept a ref directly
  • useFieldArray for dynamic, appendable/removable lists of form fields (line items, repeated groups)
  • useFormContext for prop-drilling-free access to a shared form instance across deeply nested field components
  • Built-in native HTML validation (required, min, max, pattern) plus an official @hookform/resolvers package bridging Zod, Yup, Joi, Superstruct, AJV, and class-validator schemas
  • Full TypeScript generics that infer field names, types, and error shapes directly from your form’s type or validation schema
  • A DevTools browser extension and companion form-builder for inspecting and scaffolding forms

Common Use Cases

  • Multi-field application forms (signup, checkout, settings) where re-render performance matters as field count grows
  • Forms that need schema-driven validation shared between client and server via a single Zod or Yup schema
  • Dynamic, user-extensible forms with add/remove field groups via useFieldArray (line items, contact lists, survey questions)
  • Wrapping third-party controlled UI component libraries (MUI, Chakra UI, Ant Design) inside a form via Controller
  • React Native forms, since the library has no DOM dependency and works identically off native inputs

Under The Hood

Architecture The library centers on a single factory, createFormControl (src/logic/createFormControl.ts, ~2000 lines), which builds a stateful control object shared by every hook and component in a form tree. useForm (src/useForm.ts) instantiates this control once per form and memoizes it across renders; register attaches refs directly to DOM inputs rather than routing their values through React state, so raw input changes bypass React’s render cycle entirely. Form state (errors, dirtyFields, touchedFields, etc.) is exposed through a subject/observer pattern (createSubject in src/utils) so that useFormState, useWatch, and Controller can each subscribe to only the slices they read, and React only re-renders the specific consumers whose subscribed state actually changed on a given update. useFieldArray and useController layer on top of this same control object to handle dynamic arrays and controlled-component bridging without duplicating the core state machine.

Tech Stack Written entirely in TypeScript (99% of the codebase) with zero runtime dependencies — peerDependencies lists only react (^16.8.0 || ^17 || ^18 || ^19), and validation-schema support is delegated to a separate @hookform/resolvers package rather than bundled in. The build pipeline uses Rollup (scripts/rollup) to produce CJS, ESM, and UMD bundles plus a dedicated React Server Components entry point (index.react-server.ts), and Microsoft’s API Extractor to generate and lint the public .d.ts surface, which is how the project keeps its TypeScript generics stable across releases.

Code Quality Tests are extensive and colocated: src/__tests__ mirrors the hook/logic structure with 115 test files matching 115 non-test source files, run via Jest with @swc/jest for fast TypeScript transpilation and @testing-library/react for hook/component behavior assertions; a separate src/__typetest__ suite type-checks the public generics with tsc. ESLint (flat config, eslint.config.mjs) plus simple-import-sort and Prettier are enforced via Husky + lint-staged pre-commit hooks, and a bundlewatch budget (14.0 kB max for the CJS bundle) gates bundle-size regressions in CI.

API Design The public API is small and consistently named — register, handleSubmit, watch, reset, setValue, getValues — and a minimal quickstart (useForm() + register() + handleSubmit()) is enough to get a validated form working, with Controller as the documented escape hatch for controlled third-party inputs. Generic type inference (form values flow from a single type parameter or a Zod/Yup schema into every hook’s return type) means field-name typos and mismatched validation rules surface as compile errors rather than runtime bugs, which is unusually strong ergonomics for a UI-state library.

Used by 132 apps in this directory

Python
78%
AGPL 3.0

Skyvern

AI Agents · Automation

23,088

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
70
Dependency
Built with
Python 78%
TypeScript 20%
Updated 1 weeks ago
TypeScript
97%
Other

Sourcebot

AI Code Assistants · Developer Tools · Search

3,952

A self-hosted, AI-powered code search engine that indexes every repo across GitHub, GitLab, Bitbucket, Gitea, Gerrit, and Azure DevOps, so both engineers and coding agents can search, browse, and ask questions about your codebase from one place.

View details
85
Repo Health
83
Technical
62
Dependency
Built with
TypeScript 97%
Updated 2 weeks ago
Rust
77%
AGPL 3.0

Spacedrive

Collaboration · File Storage

39,041

One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.

View details
56
Repo Health
84
Technical
63
Dependency
Built with
Rust 77%
TypeScript 20%
Updated 2 months ago
TypeScript
98%
MIT

SplitPro

Invoicing Finance

1,458

Self-hosted, open source expense splitting with multi-currency, recurring bills, and bank imports — a complete Splitwise replacement you control.

View details
77
Repo Health
77
Technical
69
Dependency
Built with
TypeScript 98%
Updated 1 months ago
Ruby
64%
BSD 3

Spree Commerce

CRM · Ecommerce · Marketing

15,733

Open-source headless eCommerce platform with a REST API, TypeScript SDK, and Next.js storefront for B2B, cross-border, and marketplace commerce — no vendor lock-in, no platform fees.

View details
90
Repo Health
84
Technical
81
Dependency
Built with
Ruby 64%
TypeScript 35%
Updated 2 weeks ago
TypeScript
89%
Other

Hexclave

Authentication · Developer Tools

6,862

The open-source user infrastructure platform — authentication, teams, payments, emails, analytics, and more on a single unified user model.

View details
87
Repo Health
80
Technical
66
Dependency
Built with
TypeScript 89%
Updated 1 weeks ago
TypeScript
95%
Other

Suna

AI Agents

20,238

Turn your company into a git repo — one config, one command center, a workforce of AI agents that runs the real work around the clock.

View details
90
Repo Health
79
Technical
66
Dependency
Built with
TypeScript 95%
Updated 1 weeks ago
TypeScript
72%
Apache 2.0

Supabase

Authentication · Databases · Developer Tools

110,828

The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.

View details
90
Repo Health
91
Technical
62
Dependency
Built with
TypeScript 72%
MDX 26%
Updated 1 weeks ago
TypeScript
85%
Apache 2.0

superset

AI Code Assistants · AI Development

14,690

Orchestrate an army of AI coding agents—Claude Code, Codex, Gemini CLI, and more—running simultaneously in isolated git worktrees from a single Electron desktop app.

View details
86
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 85%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers