Shadcn Hooks

useLatest

A hook to get the latest value of a variable

Installation

npx shadcn@latest add @shadcnhooks/use-latest

API

/**
 * A hook to get the latest value of a variable
 * @param value - The value to get the latest value of
 * @returns The latest value of the variable
 */
export function useLatest<T>(value: T): RefObject<T>

Credits

Last updated on

On this page