useForm

The

useForm
hook is used together with useField to create fully controlled forms.

Checkout the Forms Guide for an in depth guide on how to use it.

Do's & Don'ts

Make sure to always use

e.preventDefault()
or else the browser will submit the form.

Params

All params are passed as arguments.

Name
Type
Default
Description
fields*
array<fields>
A list of fields where a field describes what is returned form
useField

Returns

Object
: An object containing the following shape:

Tip: The callback function passed to

submit
can also accepts
async
functions. This is useful if we want to
await
network requests.

Examples