useCounter ​
Hook that manages a counter with increment, decrement, reset, and set functionalities
typescript
import { useCounter } from '@siberiacancode/reactuse';
Usage ​
typescript
const { count, dec, inc, reset, set } = useCounter(5);
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
initialValue? | number | 0 | The initial number value |
options.min? | number | Number.NEGATIVE_INFINITY | The min of count value |
options.max? | number | Number.POSITIVE_INFINITY | The max of count value |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
params.initialValue? | number | 0 | The initial number value |
params.min? | number | Number.NEGATIVE_INFINITY | The min of count value |
params.max? | number | Number.POSITIVE_INFINITY | The max of count value |