Skip to content

Function: useForm() ​

ts
function useForm<FormDefinition>(definition, ...args): Form<FormDefinition>;

Defined in: react/src/use-form.ts:40

Creates a form once per component. It does not re-render the component; read what the component shows with useNodeState or useField. Options left out come from the nearest FormTreeProvider. The form id comes from useId() unless id is given. A new deps value is passed to setDeps, so dependencies can be written inline. When the component unmounts, pending checks are cancelled.

Type Parameters ​

Type Parameter
FormDefinition extends Definition

Parameters ​

ParameterType
definitionFormDefinition
...argsCreateFormArguments<FormDefinition>

Returns ​

Form<FormDefinition>

Released under the MIT License.