1.0.0 • Published 9 months ago
@nwbm/use-changes v1.0.0
@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.
1.0.0
9 months ago