1.0.0 • Published 4 years ago

react-formfy-validate v1.0.0

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

react-formfy

Input status manager and form validation.

NPM JavaScript Style Guide

Install

npm install --save react-formfy

Usage

import React from 'react'

import { useFormfy, Input } from 'react-formfy'

const App = () => {
  const email = useFormfy('email')

  function handleSubmit(event) {
    event.preventDefault()
    if (email.validate()) {
      console.log('Enviar')
    } else {
      console.log('Não enviar')
    }
  }

  return (
    <form onSubmit={handleSubmit}>
      <Input
        label='email'
        id='email'
        type='email'
        placeholder='email'
        {...email}
      />
      <button>Enviar</button>
    </form>
  )
}

License

MIT © MatthausZillig