Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 9, 2024 via pnpm

react-hook-form 7.46.1

Performant, flexible and extensible forms library for React Hooks
Package summary
Share
0
issues
1
license
4
MIT
Package created
20 Mar 2019
Version published
4 Sep 2023
Maintainers
1
Total deps
4
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
4 Packages, Including:
js-tokens@4.0.0
loose-envify@1.4.0
react-hook-form@7.46.1
react@18.2.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of react-hook-form 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
react18.2.079.25 kBMIT
prod peer

Visualizations

Frequently Asked Questions

What does react-hook-form do?

React-hook-form is a highly performant, flexible, and extensible forms library designed specifically for React Hooks. It focuses on providing excellent user experience and developer experience. React-hook-form embraces the native HTML form validation, enabling integration with several UI libraries out of the box. Moreover, it's a lightweight package with no dependencies and supports popular validation libraries such as Yup, Zod, AJV, Superstruct, Joi, among others.

How do you use react-hook-form?

To use react-hook-form in your React application, first, you need to install the npm package using the command npm install react-hook-form. Here's a simple example demonstrating the usage of 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 a number for age.</p>}
      <input type="submit" />
    </form>
  );
}

In this code, the useForm hook from react-hook-form is called, which provides functions and data to manage form states. The register function is used for collecting input data, the handleSubmit function is used for handling form submission and formState object is used to get any error messages.

Where are the react-hook-form docs?

For a detailed understanding and learning of react-hook-form, you can refer to their documentation at React Hook Form API. The documentation offers a comprehensive guide on how to get started, API details, FAQs, and a wide range of practical examples to use the library effectively for implementing form validations in your React applications.