testingsimplereactvalidatorwithhooks

1.0.0 • Public • Published

Use of SimpleReactValidator in functional component using Hooks

Usage

  1. Initialize the validator
  const [validator, showValidationMessage] = useValidator(customMessages, customValidator)
  1. Add validation rules under inputs
  validator.message('password', password, 'required')
  1. Check if validation passes and turn on message
  if (validator.allValid()) {
    console.log('Submit Data')
  } else {
    // turn on validation message and re-render
    showValidationMessage(true)
  }

Readme

Keywords

none

Package Sidebar

Install

npm i testingsimplereactvalidatorwithhooks

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

422 kB

Total Files

9

Last publish

Collaborators

  • kiran2020