close
The Wayback Machine - https://web.archive.org/web/20220215225833/https://github.com/react-hook-form/react-hook-form
Skip to content
master
Switch branches/tags
Code

Latest commit

#7824)

* πŸŽ’ export UseFieldArrayUpdate and  UseFieldArrayReplace type

* update api extrator

* udpate api extrator
4a5a539

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Feb 11, 2022
Demo.mp4

npm downloads npm npm Discord

Get started | API | Examples | Demo | Form Builder | FAQs

Features

Install

npm install react-hook-form

Quickstart

import React from 'react';
import { useForm } from 'react-hook-form';

function App() {
  const {
    register,
    handleSubmit,
    formState: { errors },
  } = useForm();
  const onSubmit = (data) => console.log(data);

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <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>
  );
}
Image

Sponsors

Thanks go to these kind and lovely sponsors (companies and individuals)!

Image Image Image Image Image

@sayav @lemcii @washingtonsoares @lixunn @SamSamskies @peaonunes @wilhelmeek @iwarner @joejknowles @chris-gunawardena @Tymek @Luchanso @vcarel @gragland @tjshipe @krnlde @msutkowski @mlukaszczyk Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image Image

Backers

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

Image

Contributors

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

Image

Helpers

Thank you for helping and answering questions from the community.

Image Image Image Image Image Image Image Image Image Image

Organizations

Thanks go to these wonderful organizations! [Contribute].

Image