Skip to content

Build forms without the friction.

Performant, flexible and extensible forms with easy-to-use validation.

Quick start · try it

mode
validation
rules
App.tsx
import { useForm } from "react-hook-form"
export default function App() {
const {
register,
handleSubmit,
formState: { errors },
} = useForm()
return (
<form onSubmit={handleSubmit(console.log)}>
<input
{...register("firstName", {
required: "First name is required",
minLength: { value: 2, message: "Min length is 2" },
})}
/>
<p>{errors.firstName?.message}</p>
<input
{...register("email", {
required: "Email is required",
pattern: { value: /^\S+@\S+\.\S+$/, message: "Invalid email" },
})}
/>
<p>{errors.email?.message}</p>
<input
type="number"
{...register("age", {
valueAsNumber: true,
})}
/>
<p>{errors.age?.message}</p>
<button type="submit">Submit</button>
</form>
)
}
Live preview
formState
{
"errors": {},
"isDirty": false,
"dirtyFields": {},
"touchedFields": {},
"isValid": false,
"submitCount": 0
}

Features

Why React Hook Form

Everything you need to build forms, without the boilerplate.

DX

Intuitive, feature-complete API providing a seamless experience to developers when building forms.

HTML standard

Leverage existing HTML markup and validate your forms with our constraint-based validation API.

Super Light

Package size matters. React Hook Form is a tiny library without any dependencies.

Performance

Minimizes the number of re-renders, minimizes validation computation, and provides faster mounting.

Adoptable

Since form state is inherently local, it can be easily adopted without other dependencies.

UX

Strives to provide the best user experience and bring consistent validation strategies.

Try it

Live Demo

The following form demonstrates form validation in action. Each column represents what has been captured in the custom hook. You can also change fields in the form by clicking the EDIT button.

Example

or

Watch

ⓘ Change input values to update watched values

{}

Errors

ⓘ Validation errors will appear here

Touched

ⓘ Touched fields will display here

[]

Sponsors

Supported and backed by

React Hook Form is free and open source, sustained by the companies and individuals who sponsor its development.

Performance

Isolate Re-renders

Isolate component re-renders for better performance on your page or app. Type in both forms to compare.

React Hook Form

uncontrolled
Child Component A0 re-renders
Child Component B0 re-renders
Child Component C0 re-renders

Controlled Form

useState
Child Component A0 re-renders
Child Component B0 re-renders
Child Component C0 re-renders

Subscriptions

Subscribe to what changes

Performance is an important aspect of user experience in terms of building forms. Subscribe to individual input and form state updates without re-rendering the entire form.

useWatch re-renders only the components that read the value, not the whole form.

Benchmarks

Faster Mounting

Fewer components to mount means a faster first render. Here is how React Hook Form compares with others when mounting the same form.

React Hook Formfastest

mount
1
commit
1
total
1800ms

Others

mounts
6
commit
1
total
2070ms

Adoption

Strong Adoption

One of the most downloaded React form libraries, trusted by developers and enterprises worldwide.

Monthly npm downloads

Recognition

Highlights

This project is getting recognized by the community and industry. It's helping more developers to build forms in React than ever.

Javascript Rising Star

React Hook Form have matured and evolved around hooks. Simplifies a piece of React development.

React Open Source Awards

The winner of 2020 GitNation React OS Award for the category of Productivity Booster.

Community

The Community

Built and driven by the community. Get involved, get help, or help keep the project going.

Video

Watch the tutorial

A quick walkthrough of React Hook Form for React Web and React Native.

Ready to get started?

Form handling doesn't have to be painful. React Hook Form will help you write less code while achieving better performance.