SSE Hooks

useLocalStorage

Custom hook that uses the [localStorage API](https://developer.

Installation

npx sse-tool add use-local-storage

Usage

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

const [count, setCount, removeCount] = useLocalStorage("count", 0);
// Access the `count` value, the `setCount` function to update it and `removeCount` function to remove the key from storage.

API

Parameters

| Name | Type | Description | | :----------- | :----------------------- | :------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | | key | string | The key under which the value will be stored in local storage. | | initialValue | T | Function | The initial value of the state or a function that returns the initial value. | | options | UseLocalStorageOptions | Options for customizing the behavior of serialization and deserialization (optional). |

Return Value

Returns any.

A tuple containing the stored value, a function to set the value and a function to remove the key from storage.

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