An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

        

# @taystack/use-storage

> Strong types for local storage access using react hooks.

[![NPM](https://img.shields.io/npm/v/@taystack/use-storage.svg)](https://www.npmjs.com/package/@taystack/use-storage) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](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).