hooks/use-previous
Functions
usePrevious()
usePrevious<
T>(value):T|undefined
Defined in: hooks/use-previous.ts:10
Returns the value from the previous render. On the first render it returns
undefined, since there is no prior value yet.
Type Parameters
T
T
Parameters
value
T
Returns
T | undefined
Example
const prevCount = usePrevious(count)