📋 React Hooks for form state management and validation (Web + React Native)
Browse by type
<a href="https://react-hook-form.com" title="React Hook Form - Simple React forms validation">
<img src="https://raw.githubusercontent.com/react-hook-form/react-hook-form/master/docs/logo.png" alt="React Hook Form Logo - React hook custom hook for form validation" />
</a>
Get started | API | Form Builder | FAQs | Examples
npm install react-hook-form
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 &&
Last name is required.
}
<input {...register('age', { pattern: /\d+/ })} />
{errors.age &&
Please enter number for age.
}
<input type="submit" />
</form>
);
}
We’re incredibly grateful to these kind and generous sponsors for their support!
Thank you to our previous sponsors for your generous support!
Thanks go to all our backers! [Become a backer].
Thanks go to these wonderful people! [Become a contributor].
Documentation website supported and backed by Vercel
$ claude mcp add --transport http codehub https://codehub.bot/mcp
One hosted endpoint, no key: your agent can search, read and trace react-hook-form/react-hook-form and every other graph here. Cursor, Windsurf and other clients →