SSE Hooks

useCounter

Custom hook that manages a counter with increment, decrement, reset, and setCount functionalities.

Installation

npx sse-tool add use-counter

Usage

import { useCounter } from "./{hooks file}";

const { count, increment, decrement, reset, setCount } = useCounter(5);

API

Parameters

NameTypeDescription
initialValuenumberThe initial value for the counter.

Return Value

Returns UseCounterReturn.

An object containing the current count and functions to interact with the counter.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026