Skip to content

useIsChanged

useIsChanged subscribes to the changed state of a field. It will only trigger a rerender when the status changes.

‘Changed’ is defined as having undergone any modification. A field is still considered “changed” even if it has been changed and subsequently reverted.

A field being changed implies that any parent fields have also been changed.

const form = useForm({
initialValues: { username: "admin" }
});
const isChanged: boolean = useIsChanged(form("username"));
function useIsChanged(field: FormField<any>): boolean