@nex-ui/hooks
Version:
A collection of React Hooks for Nex UI components.
18 lines (15 loc) • 435 B
TypeScript
import * as react from 'react';
/**
* A custom hook that returns a ref to the latest value.
* This is useful to avoid stale closures in event handlers or effects.
*
* @param value - The value to keep track of.
* @returns A ref object containing the latest value.
*
* @example
* ```tsx
* const latestValue = useLatest(someValue);
* ```
*/
declare const useLatest: <T>(value: T) => react.RefObject<T>;
export { useLatest };