An object to define custom behaviour of the counter.
The initial value of the counter.
The increment to add or sub for every operation.
An object containing the current value of the counter and some functions to update it.
Decrement the counter using the step argument.
Increment the counter using the step argument.
// Initialize a counter with a step size of 2
const { count, increment, decrement } = useCounter({ initialCount: 0, step: 2 });
// Increment the counter
increment(); // count becomes 2
// Decrement the counter
decrement(); // count becomes 0
Generated using TypeDoc
A custom hook to manage a counter.