import React from 'react' import ReactDOM from 'react-dom' import { useForm } from '../' const TextError: React.FC<{ error?: string }> = ({ error }) => (!error ? null :
{error}
) const Index: React.FC = () => { const { field, form, errors, isValid } = useForm( { username: '', password: '', type: 'formhero', awesome: true, }, { username: [ /^test/, { validator: async () => { return true }, message: 'Digits please', }, ], password: { validator: /^.{3,}$/, message: 'To short', }, awesome: value => !!value, } ) const _submit = (e: React.FormEvent) => { e.preventDefault() console.log(form, errors, isValid) } return (
Username


Password


Which one to choose?




) } ReactDOM.render(, document.getElementById('root')) // @ts-ignore // if (module.hot) module.hot.accept()