usePrevious
Lifecycle & refsReturns the previous distinct value (the value from the last render it changed)
Install
$ npm install @usefy/use-previousQuick start
usePrevious.tsx
import { usePrevious } from "@usefy/use-previous";
const [count, setCount] = useState(0);
const prev = usePrevious(count); // undefined, then the previous valueAPI reference
usePrevious<T>(value, isEqual?): T | undefined — tracks the previous distinct value; pass isEqual (defaults to Object.is) to ignore new-but-equal values.
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.