The most unopinionated react form hook.
npm install use-form-react
Form hook made blazing fast and easy.
> The most unopinionated form hook.
``shell`
npm i --save use-form-reactor
yarn add use-form-react
!demo
check basic example
`jsx
import useForm from 'use-form-react'
const Form = () => {
const { onSubmit, onChange, inputs } = useForm('sampleForm', {
initialValues: { 'name': '' },
callback: (inputs) => console.log(inputs)
}
)
return (
$3
check advance example
`jsx
import React, { useEffect } from 'react';
import useForm from 'use-form-react'const SignUp = () => {
const options = {
initialValues: {
'email': '',
'password1': '',
'password2': ''
},
callback: () => console.log('it works'),
debug: true
}
const {
onSubmit, onChange, inputs, dirty, submitting, reset
} = useForm('myAdvanceFormName', option)
useEffect(() => {
if(inputs.password1!==inputs.password2) console.log('password not matched')
});
return (
);
}
``- [ ] better test case
- [ ] debounce the error
- [ ] built-in validation
MIT