0.9.6 • Published 1 year ago

@milkyweb/use-form v0.9.6

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
1 year ago

useForm

Trying to make the simplest react form hook

NPM JavaScript Style Guide

Get Started

Install

npm install --save @milkyweb/use-form

or

yarn add @milkyweb/use-form

Register a Form

Inside another hook or your component:

const { register, handleSubmit } = useForm()

Register Fields

After the useForm initialization, you can use the register function to define new fields. This function returns 3 objects, e.g:

const { props, isTouched, errors } = register('name')
  • The props object must be passed to the form field.
  • isTouched turns into true when the user first touches the fields
  • And error is an object containing possible errors
<input name='lastname' type='text' {...props} />

Events

License

GNUv3 © x0y-gt

0.9.4

1 year ago

0.9.6

1 year ago

0.9.5

1 year ago

0.9.3

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.9.0

1 year ago