Skip to content

react-hook-form/react-hook-form

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* πŸ›€οΈ keep track of traversed types to avoid self-referencing while constructing paths for a type (#9540)

* Keep track of traversed types to avoid self-referencing while constructing  paths for a type

* Ran api-extractor

* Addressed code review

* Impoved robustness of recursion avoidance and added tests

Co-authored-by: Beier (Bill) <bluebill1049@hotmail.com>

* πŸ‹πŸ»β€β™€οΈ reduced code with unset (#9575)

Co-authored-by: Beier (Bill) <bluebill1049@hotmail.com>

* ⌨️ fix type for setValue to only accept non `undefined` value (#9528)

* fix type for setValue to only accept non undefined value

* update api extrator

* update api extrator

* πŸ“” fix warning for setValue test case

* Revert "⌨️ fix type for setValue to only accept non `undefined` value (#9528)"

This reverts commit b3a33e7.

* πŸ“½ feature: `validate` function to include formValues (#9079)

* feature: validate function to include formValues

* update test cases

* update api contract

* update contract and fix tests

* update api extrator

* update test

* update api extrator

* improve handleSubmit function (#9688)

* improve handleSubmit function

* fix build error

* update deps

* revert change on clear errors state

* fix cypress tests

* 7.42.0-next.0

* 🌏 feature: support global error type

* support number type for status code

* update deps and api extrator

* fix type test

* support root error

* 7.43.0-next.0

Co-authored-by: Linn Dahlgren <hello@linn.lgbt>
Co-authored-by: Alex Liu <39984251+Mini-ghost@users.noreply.github.com>
af094a2

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time

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!

Backers

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

Contributors

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