Skip to content

useFieldData

useFieldData subscribes to a field’s data. It will only trigger a rerender when the value changes.

const form = useForm({
initialValues: { username: "admin" }
});
const username = useFieldData(form("username"));
//^? string
return (
<div>Username: { username }</div>
)
function useFieldData<T>(field: FormField<T>): T