UNPKG

@modern-kit/react

Version:
22 lines (19 loc) 665 B
import { Dispatch, SetStateAction } from 'react'; interface UseSessionStorageWithoutInitialValueProps { key: string; } interface UseSessionStorageWithInitialValueProps<T> { key: string; initialValue: T | (() => T); } declare function useSessionStorage<T>({ key, initialValue, }: UseSessionStorageWithInitialValueProps<T>): { state: T; setState: Dispatch<SetStateAction<T>>; removeState: () => void; }; declare function useSessionStorage<T = unknown>({ key, }: UseSessionStorageWithoutInitialValueProps): { state: T | null; setState: Dispatch<SetStateAction<T | null>>; removeState: () => void; }; export { useSessionStorage };