1.0.0 • Published 9 months ago

@nwbm/use-changes v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@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.