Skip to content

πŸ“‹ React Hooks for form state management and validation (Web + React Native)

License

Notifications You must be signed in to change notification settings

Lper258/react-hook-form

This branch is 65 commits behind react-hook-form/react-hook-form:master.

Folders and files

NameName
Last commit message
Last commit date
Nov 8, 2023
Oct 12, 2024
Jul 10, 2024
Aug 18, 2023
Oct 12, 2024
Sep 7, 2024
Oct 2, 2023
Dec 6, 2022
Oct 12, 2024
Jul 7, 2024
Oct 12, 2024
Dec 23, 2021
Dec 5, 2022
Dec 25, 2021
May 10, 2021
Oct 12, 2024
Apr 3, 2019
Jul 5, 2024
Sep 15, 2019
Sep 17, 2024
May 26, 2021
Feb 16, 2022
Jul 30, 2022
Oct 12, 2024
Oct 12, 2024
Oct 12, 2024
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].

About

πŸ“‹ React Hooks for form state management and validation (Web + React Native)

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.7%
  • JavaScript 1.2%
  • Other 0.1%