Hook to subscribe to form state changes with optimized re-renders, optionally scoped to specific fields or form control.
// Source: https://github.com/react-hook-form/react-hook-form | License: MIT | Copyright 2019-present Beier(Bill) Luo
// Provided via justclaw.it.com; keep this notice with the code.
import React from 'react';
import getProxyFormState from './logic/getProxyFormState';
import type {
FieldValues,
FormState,
UseFormStateProps,
UseFormStateReturn,
} from './types';
import { useFormControlContext } from './useFormControlContext';
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect';
import { useResyncOnReconnect } from './useResyncOnReconnect';
/**
* Subscribes to form state with re-renders isolated to this hook.
* Optionally scope to specific field names to minimize re-render surface.
*
* @see [API](https://react-hook-form.com/docs/useformstate)
*
* @example
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key