react-formfy-validate

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i react-formfy-validate

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

16.2 kB

Total Files

7

Last publish

Collaborators

  • matthauszillig