Docs
useCounter
Manage a numeric state with useCounter, offering functions to increment, decrement, reset, and set a custom value.
Installation
Usage
API Reference
Parameters
Name | Type | Description |
---|---|---|
initialValue? | number | The initial value for the counter. |
Returns
Name | Type | Description |
---|---|---|
count | number | The current count value. |
decrement | () => void | Function to decrement the counter by 1. |
increment | () => void | Function to increment the counter by 1. |
reset | () => void | Function to reset the counter to its initial value. |
setCount | Dispatch<SetStateAction<number>> | Function to set a specific value to the counter. |