rooks
Version:
Collection of awesome react hooks
17 lines (16 loc) • 578 B
TypeScript
import type { Dispatch, SetStateAction } from "react";
type UseLocalstorageStateReturnValue<S> = [
S,
Dispatch<SetStateAction<S>>,
() => void
];
/**
* useLocalstorageState hook
* Tracks a value within localStorage and updates it
*
* @param {string} key - Key of the localStorage object
* @param {any} initialState - Default initial value
* @see https://rooks.vercel.app/docs/hooks/useLocalstorageState
*/
declare function useLocalstorageState<S>(key: string, initialState?: S | (() => S)): UseLocalstorageStateReturnValue<S>;
export { useLocalstorageState };