@vtex/admin-ui
Version:
> VTEX admin component library
10 lines (9 loc) • 395 B
TypeScript
import type { Dispatch, SetStateAction } from 'react';
/**
* Use local storage to persist a state
* @param defaultValue - value if the key is not found within localstorage
* @param key - localstorage key
* @example
* const [state, setState] = usePersistentState('')
*/
export declare function usePersistentState<T>(defaultValue: T, key: string): [T, Dispatch<SetStateAction<T>>];