UNPKG

state-hooks

Version:

Essential set of React Hooks for convenient state management.

16 lines (15 loc) 605 B
/** * Tracks whether a value has changed over a relatively given period of time. * * @param value Props, state or any other calculated value. * @param {number} groupingIntervalMs Time interval, in milliseconds, to group a batch of changes by. * @returns `true` if the value has changed at least once over the given interval, or `false` otherwise. * * @example * function Component() { * const scrollCoords = useWindowScrollCoords(); * const isScrolling = useChanging(scrollCoords); * // ... * } */ export default function useChanging<T>(value: T, groupingIntervalMs?: number): boolean;