import { useCounter } from "https://deno.land/x/netzo@0.4.72/deps/usehooks-ts.ts";
Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.
Examples
// Usage of useCounter hook
const { count, increment, decrement, reset, setCount } = useCounter(5);
console.log(Current count: ${count}
);
increment(); // Increases count by 1
decrement(); // Decreases count by 1
reset(); // Resets count to its initial value
setCount(10); // Sets count to 10
// Usage of useCounter hook
const { count, increment, decrement, reset, setCount } = useCounter(5);
console.log(Current count: ${count}
);
increment(); // Increases count by 1
decrement(); // Decreases count by 1
reset(); // Resets count to its initial value
setCount(10); // Sets count to 10