API

useField()


useField()

import { useField } from 'react-final-form'
(name: string, config: UseFieldConfig) => FieldRenderProps

The useField() hook takes two parameters:

name

string

Required

The name of the field.

config

UseFieldConfig

Optional.

An object that looks just like FieldProps, except without the name.

useField() returns FieldRenderProps. It will manage the rerendering of any component you use it in, i.e. the component will only rerender if the field state subscribed to via useField() changes.

useField() is used internally inside <Field/>.