useCounter
Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
Usage
import { useCounter } from "@tilt-legal/cubitt-components/utilities/hooks";
const { count, increment, decrement, reset, setCount } = useCounter(5);API
Signature
declare function useCounter(initialValue?: number): UseCounterReturn;Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
[initialValue] | number | The initial value for the counter. | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | UseCounterReturn | An object containing the current count and functions to interact with the counter. |