useForm(), which is given a
form schema.
How to build a form
The process to build a form is:- Create a form schema.
- Destructure the form components you need from
useForm(). - Render the components. Wrap your form inputs in a
<Form/>. - Define your
onSubmitfunction in<Form/>.
Example: Simple Form
simple-form.tsx
Example: Complex validation
Sometimes you may need to add more complex validation than a static schema can express. For example, you might want to ensure that the minimum value is less than the maximum value. You can achieve this by passing a validation function touseForm().
complex-validation.tsx