useLatest
Lifecycle & refsReturns a ref that always holds the latest value
Install
$ npm install @usefy/use-latestQuick start
useLatest.tsx
import { useLatest } from "@usefy/use-latest";
const latest = useLatest(value);
// read latest.current inside stable callbacks / listenersAPI reference
useLatest<T>(value): { readonly current: T } — a stable ref whose current is updated to the latest value on every render.
Go deeper
This page is the quick reference. For every example, prop, and edge case, read the full README — or open Storybook to change props live.