Skip to main content
This component is returned by useForm().

Example: Conditional fields

<WithState /> allows you to access the form values via render props in the JSX, so you can conditionally render fields.
conditional-fields-dialog.tsx

Example: Submitting state

<WithState /> allows you to know whether or not the form is currently being submitted, so you can change the UI, e.g. disabling a secondary button.
submitting-state-dialog.tsx

Props

errors
boolean
Whether or not to request the form validation errors.Defaults to false.If true, the errors will be passed to the children render prop.
submitting
boolean
Whether or not to request whether the form is currently being submitted.Defaults to false.If true, the submitting will be passed to the children render prop.
values
boolean
Whether or not to request the form values.Defaults to false.If true, the values will be passed to the children render prop.
children
({ errors, submitting, values }) => React.ReactNode
A render prop that receives the requested form state.

errors? : Object

An object of form validation errors in the same shape as your form values.

submitting? : boolean

true until the Promise resolves from onSubmit, false otherwise.

values? : Object

The current values of your form.