1.0.2 • Published 3 years ago
react-localstorage-hooks v1.0.2
Installation
Documentation
useLocalStorageState: creates reactive state variables synced with localStorage.useLocalStorageReducer: similar touseReducerbut abstracted on top of localStorage.useLocalStorageSelector: hook to select some data from localStorage that automatically updates when selected data changes.createLocalStorageDispatch: creates a dispatch method that directly updates localStorage.
Usage
Make sure your project is using React 16.18.0 or above.
Install the package using
npmoryarnnpm i react-localstorage-hooksImport the hooks either using ES6 named imports:
import { useLocalStorageState } from 'react-localstorage-hooks';or importing each hook directly from
lib:import useLocalStorageState from 'react-localstorage-hooks/lib/useLocalStorageState/useLocalStorageState';
License
This package is licensed under MIT