useClamp react hook
A React Hook to keep the given value(s) between the given minimum and maximum values.
clamp description
Installation
$ yarn add use-clamp
Import
;
Usage
const clampedValue = ;
Multiple Values
With passing array of numbers as first arguments will keep sum of the values between range.
- Each value will stay above the min value.
- If total of the values exceeds maximum value, each values will have the weighted values.
const clampedValue = ;// clampedValue = [10, 40, 25, 25]