1.0.0 • Published 4 years ago
react-formfy-validate v1.0.0
react-formfy
Input status manager and form validation.
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
1.0.0
4 years ago