UNPKG

@rooks/use-sessionstorage-state

Version:
12 lines (9 loc) 429 B
import { Dispatch, SetStateAction } from 'react'; /** * useSessionstorageState hook * Tracks a value within sessionStorage and updates it * @param {string} key - Key of the sessionStorage object * @param {any} initialState - Default initial value */ declare function useSessionstorageState<S>(key: string, initialState?: S | (() => S)): [S, Dispatch<SetStateAction<S>>, () => void]; export default useSessionstorageState;