@chainsafe/browser-storage-hooks
v1.0.1
Published
React hooks for local and session storage
Downloads
119
Readme
Browser Storage Hooks
React hooks wrapper for local and session storage Browser API's.
How to use
npm i @chainsafe/browser-storage-hooks
or
yarn add @chainsafe/browser-storage-hooks
When ever local or session storage is required,
import { useLocalStorage, useSessionStorage } from "@chainsafe/browser-storage-hooks"
The hooks expose a feature flag as well as safe getters and setters for both session and local storage:
canUseSessionStorage: boolean;
sessionStorageRemove: (key: string) => void;
sessionStorageGet: (key: string) => string | null;
sessionStorageSet: (key: string, value: string) => void;