Skip to content

FieldData

<FieldData> lets you watch the value of a field’s data. It accepts a field and a render prop as its child, which is called every time the data changes.

The counterpart hook is useFieldData.

const form = useForm({
initialValues: { name: "" }
});
return (
<FieldData field={form("name")}>
{ name => <div>Your name is: {name} </div> }
</FieldData>
)
function FieldData<T>(props: {
// The field to watch the value for
field: FormField<T>
// A render function which will be passed the value
children: (value: T) => ReactNode
})