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
Whether or not to request the form validation errors.Defaults to
false
.If true
, the errors
will be passed to the children
render prop.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.Whether or not to request the form values.Defaults to
false
.If true
, the values
will be passed to the children
render prop.A render prop
that receives the requested form state.
An object of form validation errors in the same shape as your form values.
The current values of your form.
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.