@mirawision/reactive-hooks
Version:
A comprehensive collection of 50+ React hooks for state management, UI interactions, device APIs, async operations, drag & drop, audio/speech, and more. Full TypeScript support with SSR safety.
17 lines (16 loc) • 452 B
TypeScript
type UseLocalStorage<T> = [
T | null,
{
set: (value: T) => void;
remove: () => void;
}
];
/**
* Hook that manages localStorage state with reactive updates
*
* @param key - localStorage key
* @param initialValue - Initial value if key doesn't exist
* @returns Tuple with current value and operations
*/
declare function useLocalStorage<T>(key: string, initialValue?: T): UseLocalStorage<T>;
export { useLocalStorage };