1.0.13 • Published 3 years ago

simple-validator-hook v1.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Simple yet very efficient React hook for validating web forms

Make sure you have npm and Node installed on your machine.

Installation guide here.

To install, run:

npm install simple-validator-hook

Important

Ensure that each html input in the form contains unique name prop <input type='text' name='password' /> Internally, we use Yup to run valiation on each unique value given to name prop.

Use

This hook returns a number of useful methods to validate inputs in html forms. If data is validated, handleSubmit function will have access to validated data which you can run any logic on or post it to your server.

The hook throttles keyboard input to ensure validation does not run on each keystroke which slows down unnecessary React renders.

The hook accepts three arguments

  • default form values
  • yup schema which is an object with required form properties
  • debounced time in milliseconds which throttles keyboard input

The github repository contains a simple React app in the example directory that shows the basic use of this hook.

Licence

MIT @ alisherk.

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago