A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/react-hook-form/react-hook-form below:

react-hook-form/react-hook-form: 📋 React Hooks for form state management and validation (Web + React Native)

Get started | API | Form Builder | FAQs | Examples

npm install react-hook-form
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>
  );
}

We’re incredibly grateful to these kind and generous sponsors for their support!

Thank you to our previous sponsors for your generous support!

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

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

Documentation website supported and backed by Vercel


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4