react-use-storage-state
Version:
React use hook for shared and persisted state
6 lines (5 loc) • 371 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
declare type Value<T> = T extends Function ? never : T;
declare type NonFunctionalValue = Value<any>;
export declare function useStorageState<T extends NonFunctionalValue>(key: string, initialState: T | (() => T), storageArea?: Storage): [state: T, setState: Dispatch<SetStateAction<T>>];
export default useStorageState;