kawkab-frontend
Version:
Kawkab frontend is a frontend library for the Kawkab framework
11 lines (10 loc) • 478 B
TypeScript
/**
* A React hook to manage a value in localStorage.
* The component will re-render when the value changes.
* Automatically handles JSON serialization and parsing.
*
* @param key The key for the localStorage item.
* @param defaultValue The default value if nothing is stored.
* @returns A state-like array: [value, setValue, removeValue].
*/
export declare function useLocalStorage<T>(key: string, defaultValue?: T): [T | undefined, (newValue: T) => void, () => void];