@nwbm/use-changes
v1.0.0
Published
React hooks for tracking value changes
Downloads
6
Maintainers
Readme
@nwbm/use-changes
Pack of hooks for convenient values comparison.
Installation
npm install @nwbm/use-changes
Available hooks
useOnChange
Execute callback when the given value has changed, accordingly to given comparator logic.
useChanged
Returns new value of given one only if it has changed, accordingly to given comparator logic.
useDiff
Calculate new value from given one, based on its current a previous value.
useChanges
Low-level hook, returning "meta" data about the comparison: current value, previous value, and whether the value has changed.