# @shenglong/use-localstorage

> Use localStorage with react hook

Latest version **1.0.0** (published 2021-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @shenglong/use-localstorage
pnpm add @shenglong/use-localstorage
yarn add @shenglong/use-localstorage
bun add @shenglong/use-localstorage
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-01-28 |
| First published | 2021-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shenglong Yu |
| Maintainers | shenglong |
| Keywords | localStorage, react, hooks |

## Links

- npm: https://www.npmjs.com/package/@shenglong/use-localstorage
- Repository: https://github.com/shenglongy/use-localstorage
- Homepage: https://github.com/shenglongy/use-localstorage#readme
- Issues: https://github.com/shenglongy/use-localstorage/issues
- npm.io page: https://npm.io/package/@shenglong/use-localstorage

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-01-28

## README

# use-localstorage

A Hook for persisting state into localStorage.

## Install

``` sh
$ npm install --save @shenglong/use-localstorage
```

Or with Yarn

``` sh
$ yarn add @shenglong/use-localstorage
```

## Usage

```javascript
import useLocalStorage from "@shenglong/use-localstorage"

function App() {
  const [name, setName] = useLocalStorage('name', 'Bob');

  return (
    <input
      type="text"
      placeholder="Enter your name"
      value={name}
      onChange={e => setName(e.target.value)}
    />
  )
}
```

---
_Source: https://npm.io/package/@shenglong/use-localstorage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
