React Hook Form
react-hook-form
Performant, flexible and extensible forms library for React Hooks
Forms
react
hooks
form
forms
form-validation
validation
typescript
react-hooks
react-hook-form
javascript
Stars
45k
Weekly
38M
Open issues
8
Bundle
~15 kB
Installation
npm install react-hook-formCode example
import { useForm } from "react-hook-form";
type FormValues = { email: string };
export function Example() {
const { register, handleSubmit } = useForm<FormValues>();
return (
<form onSubmit={handleSubmit((values) => console.log(values))}>
<input type="email" placeholder="you@example.com" {...register("email", { required: true })} />
<button type="submit">Submit</button>
</form>
);
}Pros & cons
Pros
- Actively maintained by Beier
- 38M weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~15 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 8 open issues on GitHub