react-hook-form downloads · last 12 months
react-hook-form is a React library for managing form state, field registration, and validation through hooks. It addresses the repeated work of connecting inputs to form data and handling submission, while offering a consistent approach for forms with different numbers of fields and validation needs.
Its design centers on a hook-based API and a form workflow that can be integrated into React components. The package is intended for developers building React forms who want to describe fields and submission behavior in code rather than manage every input update and state transition independently.
The main entry point is useForm, which provides form methods such as register for connecting inputs, handleSubmit for processing valid submissions, and form-state data for displaying errors and submission status. For controlled components that do not fit the standard registration pattern, Controller provides an integration path; nested components can access form methods through FormProvider and useFormContext.
The package fits React and React Native projects, and its topics include TypeScript, validation, form building, and user experience. Its hook-based form APIs can be used alongside a project’s chosen UI components and validation workflow, allowing teams to connect fields and submission handling without requiring a particular visual design system.
The listed gzip bundle size is 20.4 kB, and the package has 62.3M weekly downloads, 44.9K GitHub stars, and 2.5K forks. It is MIT-licensed, with version 7.92.0 listed as last updated on 2026-11-11; these figures describe the supplied package data and do not guarantee performance for a particular form or application.
Plan how form values and validation errors should be surfaced in your UI, especially when using controlled inputs or deeply nested fields. Forms that rely on unusual input behavior may need explicit Controller integrations, and teams should verify that their chosen validation and component patterns work with the registration and submission APIs.
- Use useForm and register to connect standard React inputs to form state without writing a separate state update handler for every field.
- Use handleSubmit to centralize form submission and process validated values through a React event workflow.
- Use form-state data from useForm to render field errors and submission feedback in the component that owns the form.
- Use Controller when a controlled input or UI component does not fit the usual register-based field pattern.
- Use FormProvider with useFormContext when fields are split across nested components and passing form methods through every layer would be cumbersome.
- Use the library for React Native forms when you want to apply its hook-based form patterns in a mobile React interface.
- Choose it for TypeScript-oriented React forms where typed form values and explicit field registration are part of the development workflow.
- Avoid it when a form only needs a few local values and a submit action; React useState and a simple submit handler may involve less form-specific setup.
- Avoid it when the UI is not built with React or React Native, because its APIs are React hooks and components.
- Avoid it when your form architecture requires a state-management model that does not fit useForm, register, and handleSubmit; use a form approach aligned with that architecture instead.
- Avoid it when every input is controlled by an existing component system and you do not want to add Controller integrations; keep state handling in that system or choose a compatible form workflow.
- Avoid it when validation must be performed entirely outside the form lifecycle; handle validation in the existing application or server workflow and connect only the resulting errors to the UI.
- Avoid it when the 20.4 kB listed gzip bundle size is outside your client-side budget; consider a lighter form implementation or native React state handling.
CORRECTIONS
Spot wrong data here?Spot wrong data on this page?
A short note helps us fix it.A short note helps us fix it. We read every one; confirmed fixes ship in the next nightly build.
Anonymous · No account · No email back