use-previous
Returns previous value of given state
Import
Source
Docs
Package
Usage
use-previous
stores the previous value of a state in a ref.
It returns undefined
on initial render and the previous value of a state after rerender:
Current value:
Previous value: