Socket
Socket
Sign inDemoInstall

react-hook-form

Package Overview
Dependencies
Maintainers
1
Versions
1030
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hook-form - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

examples/asyncValidation.tsx

1

dist/constants.d.ts

@@ -1,3 +0,2 @@

export declare const TEXT_INPUTS: string[];
export declare const DATE_INPUTS: string[];
export declare const STRING_INPUTS: string[];

@@ -7,4 +7,5 @@ declare type Validate = (data: string | number) => boolean | string | number | Date;

};
declare type Ref = HTMLInputElement | HTMLSelectElement | null;
export interface RegisterInput {
ref: HTMLInputElement | HTMLSelectElement | null;
ref: Ref;
required?: boolean | string;

@@ -52,3 +53,3 @@ min?: NumberOrString | {

declare type Error = {
ref: any;
ref: Ref;
message: string | boolean;

@@ -55,0 +56,0 @@ type: string;

@@ -62,3 +62,3 @@ import { useRef, useState, useEffect } from 'react';

const DATE_INPUTS = ['date', 'time', 'month', 'datetime', 'datetime-local', 'week'];
const STRING_INPUTS = ['text', 'email', 'password', 'search', 'tel', 'url'];
const STRING_INPUTS = ['text', 'email', 'password', 'search', 'tel', 'url', 'textarea'];

@@ -65,0 +65,0 @@ function getValueAndMessage(item) {

@@ -64,3 +64,3 @@ 'use strict';

const DATE_INPUTS = ['date', 'time', 'month', 'datetime', 'datetime-local', 'week'];
const STRING_INPUTS = ['text', 'email', 'password', 'search', 'tel', 'url'];
const STRING_INPUTS = ['text', 'email', 'password', 'search', 'tel', 'url', 'textarea'];

@@ -67,0 +67,0 @@ function getValueAndMessage(item) {

## Examples
Basic: https://codesandbox.io/s/yj07z1639
you can view the source code within the folder or visit code sand box to see how it works.
ValidationSchema: https://codesandbox.io/s/928po918qr
| Name | Link |
| ----------------------- | ----------------------------------- |
| Basic | https://codesandbox.io/s/yj07z1639 |
| Custom Input | https://codesandbox.io/s/72j69vnk1x |
| Register Error Messages | https://codesandbox.io/s/o766kp4z05 |
| AsyncValidation | https://codesandbox.io/s/m5pj55yj7x |
| ValidationSchema | https://codesandbox.io/s/928po918qr |
{
"name": "react-hook-form",
"version": "2.0.1",
"version": "2.0.2",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/index.es.js",

@@ -41,3 +41,3 @@ <div align="center"><a href="https://react-hook-form.now.sh/"><img src="https://raw.githubusercontent.com/bluebill1049/react-hook-form/master/website/logo.png" alt="React forme Logo - React hook form valiation" width="350px" /></a></div>

<input name="firstname" ref={register} />
<input name="lastname" ref={register({ required: true }} />
<input name="lastname" ref={register({ required: true })} />
<input name="lastname" ref={register({ pattern: "[a-z]{1,15}" })} />

@@ -44,0 +44,0 @@ <input type="submit" />

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc