Github url

react-hook-form

by react-hook-form

react-hook-form /react-hook-form

📋 React Hooks for forms validation (Web + React Native)

12.2K Stars 529 Forks Last release: about 2 hours ago (v6.0.2) MIT License 2.0K Commits 338 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

React Hook Form Logo - React hook custom hook for form validation

Performant, flexible and extensible forms with easy to use validation.

npm downloads npm npm Coverage Status

React Hook Form video - React custom hook for form validation

English | 简体中文 | 日本語 | 한국어 | Français | Italiano | Português | Español | Русский | Deutsch | Türkçe

Features

Install

npm install react-hook-form

Links

Quickstart

import React from 'react'; import { useForm } from 'react-hook-form'; function App() { const { register, handleSubmit, errors } = useForm(); // initialise the hook const onSubmit = (data) =\> { console.log(data); }; return (
{/* register an input */}
  <input name="lastname" ref="{register({" required: true>
  {errors.lastname &amp;&amp; 'Last name is required.'}

  <input name="age" ref="{register({" pattern:>
  {errors.age &amp;&amp; 'Please enter number for age.'}

  <input type="submit">
</form> ); }

Sponsors

Want your logo here? DM on Twitter

Backers

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

Organizations

Thanks goes to these wonderful organizations! [Contribute].

Contributors

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.