https://github.com/taystack/use-storage
Strong types for session or local storage access using react hooks.
https://github.com/taystack/use-storage
Last synced: 3 months ago
JSON representation
Strong types for session or local storage access using react hooks.
- Host: GitHub
- URL: https://github.com/taystack/use-storage
- Owner: taystack
- Created: 2021-05-13T21:59:50.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-05-14T17:35:17.000Z (about 4 years ago)
- Last Synced: 2025-04-10T00:55:12.732Z (3 months ago)
- Language: TypeScript
- Size: 341 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @taystack/use-storage
> Strong types for local storage access using react hooks.
[](https://www.npmjs.com/package/@taystack/use-storage) [](https://standardjs.com)
## Install
```bash
npm install --save @taystack/use-storage
```## Usage
Similar to `React.useState`. All `use*Storage` methods apply
```tsx
import { useLocalStorageString } from '@taystack/use-storage'function MyComponent() {
const [value, setValue] = useLocalStorageString('my_store_key', 'default value')
return (
My stored value {value}
)
}
```## License
MIT © [taystack](https://github.com/taystack)
---
This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).