UNPKG

@ucam/design-system

Version:
14 lines (13 loc) 668 B
export interface LocalStorageOptions { /** * The default value to be returned during hydration or if localStorage does not contain a value. */ defaultValue?: string | undefined; } /** * A React Hook to gets an item from local storage. * It handles SSR by returning the defaultValue for the initial hydration render, regardless of value in localStorage. * It must be used inside a `<HydrationChecker/>` (`<ThemeProvider/>` does this automatically). */ declare const useLocalStorage: (key: string, options?: LocalStorageOptions | undefined) => [string | undefined, (value: string | undefined) => void]; export default useLocalStorage;