UNPKG

qol-hooks

Version:

A collection of React hooks to improve the quality of life of developers.

17 lines (16 loc) 613 B
/** * @description A hook to store or get a value in localStorage * * @param {string} key The key to store the value in localStorage * @param {string} initialValue The initial value to store in localStorage * @returns {[string, (value: string) => void]} A tuple containing the stored value and a function to set the value * * @example```tsx * const [value, setValue] = useLocalStorage * * setValue("Hello, World!"); * console.log(value); // Hello, World! * ``` */ declare function useLocalStorage(key: string, initialValue: string): [string, (value: string) => void]; export default useLocalStorage;