Skip to content

usePrevious ​

utilities
test coverage
Last changed: 18 days ago

Hook that returns the previous value

typescript
import { usePrevious } from '@siberiacancode/reactuse';

Usage ​

typescript
const prevValue = usePrevious(value);

Demo ​

Api ​

Parameters

NameTypeDefaultNote
valueValue-The value to get the previous value
options.equality?(a: Value, b: Value) => boolean-The custom equality function to determine if the value has changed

Returns

Value

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarbabin
Avatarhywax