qol-hooks
Version:
A collection of React hooks to improve the quality of life of developers.
17 lines (16 loc) • 625 B
TypeScript
/**
* @description A hook to store or get a value in sessionStorage
*
* @param {string} key The key to store the value in sessionStorage
* @param {string} initialValue The initial value to store in sessionStorage
* @returns {[string, (value: string) => void]} A tuple containing the stored value and a function to set the value
*
* @example```tsx
* const [value, setValue] = useSessionStorage
*
* setValue("Hello, World!");
* console.log(value); // Hello, World!
* ```
*/
declare function useSessionStorage(key: string, initialValue: string): [string, (value: string) => void];
export default useSessionStorage;