@primereact/hooks
PrimeReact Hooks
Low-level React hooks used across PrimeReact components. Available as a standalone package so component authors and application developers can reuse them independently.
Lifecycle
useMountEffect, useUpdateEffect, useUnmountEffect for effects that only run at specific lifecycle points. useMounted to track whether a component has mounted yet.
DOM
useEventListener for safe attach/detach of DOM listeners. useScrollTop, usePresence, useVisibilityChange for scroll and visibility tracking.
IDs and selectors
useId for stable unique IDs across renders. useAttrSelector for consistent data-scope / data-part attribute generation.
Input utilities
useMask for input masking (numbers, dates, custom patterns). useKeyFilter to restrict which characters an input accepts. useHotKey for keyboard shortcut bindings.
Data
useFilter and useTreeFilter for list and tree filtering logic. usePrevious to track the previous value of any reactive variable.
Storage and media
useLocalStorage for persisted state. useMatchMedia and useIsMobile for responsive behavior.
Other
useControlledState for controlled/uncontrolled input patterns. useQueueTask for deferred task queuing. useViewTransition for View Transition API integration.
License
Licensed under the PrimeUI License - Copyright (c) PrimeTek Informatics