use Controllable State reference
The value / defaultValue / onValueChange pattern as a hook: the one behind every controlled prop of the viewer.
Internal state is used while value is undefined; onChange fires whenever the value changes. The setter is stable. Values must not be functions (a function argument is treated as an updater).
Used by
Import
import { useControllableState } from '@kingtech/react-pdf-viewer';Signature: useControllableState(options: UseControllableStateOptions<T>): readonly [T, SetControllableState<T>] → readonly [T, SetControllableState<T>]
Options
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
value | T | — | Yes | The controlled value; undefined = uncontrolled. |
defaultValue | T | () => T | — | Yes | Initial value while uncontrolled. |
onChange | (value: T) => void | — | No | Called with every change, controlled or not. |
name | string | — | No | Prop name used in development warnings. |
Source
packages/react-pdf-viewer/src/hooks/useControllableState.ts
Generated from content/react-pdf-viewer/reference/use-controllable-state.schema.json. Do not edit by hand.