Skip to content

react-hook-form/react-hook-form

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 28, 2025
a66b52a · Mar 28, 2025
Nov 8, 2023
Oct 12, 2024
Jul 10, 2024
Mar 12, 2025
Mar 14, 2025
Feb 15, 2025
Oct 2, 2023
Jan 11, 2025
Mar 16, 2025
Mar 14, 2025
Mar 16, 2025
Dec 23, 2021
Dec 5, 2022
Mar 14, 2025
May 10, 2021
Dec 10, 2024
Mar 14, 2025
Jul 5, 2024
Sep 15, 2019
Feb 12, 2025
Dec 1, 2024
Feb 16, 2022
Jul 30, 2022
Mar 14, 2025
Mar 28, 2025
Mar 13, 2025
Mar 22, 2022

Repository files navigation

npm downloads npm npm Discord

Get started | API | Form Builder | FAQs | Examples

Features

Install

npm install react-hook-form

Quickstart

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 && <p>Last name is required.</p>}
      <input {...register('age', { pattern: /\d+/ })} />
      {errors.age && <p>Please enter number for age.</p>}
      <input type="submit" />
    </form>
  );
}

Sponsors

Thanks go to these kind and lovely sponsors!

Past sponsors

Backers

Thanks go to all our backers! [Become a backer].

Contributors

Thanks go to these wonderful people! [Become a contributor].





Documentation website supported and backed by Vercel