Skip to content

Repository files navigation

React Hook Form Logo - React hook custom hook for form validation
Demo.mp4

npm downloadsnpmnpmDiscord

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

Features

Install

npm install react-hook-form

Quickstart

importReactfrom'react';import{useForm}from'react-hook-form';functionApp(){const{
register,
handleSubmit,formState: { errors },}=useForm();constonSubmit=(data)=>console.log(data);return(<formonSubmit={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>}<inputtype="submit"/></form>);}

Sponsors

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

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

Backers

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

Contributors

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

Helpers

Thank you for helping and answering questions from the community.

Organizations

Thanks go to these wonderful organizations! [Contribute].

About

📋 React Hooks for form state management and validation (Web + React Native)

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages