Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akash-joshi/local-storage-hook
React Hook for Local Storage
https://github.com/akash-joshi/local-storage-hook
Last synced: 14 days ago
JSON representation
React Hook for Local Storage
- Host: GitHub
- URL: https://github.com/akash-joshi/local-storage-hook
- Owner: akash-joshi
- Created: 2019-11-03T11:31:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T01:42:44.000Z (7 months ago)
- Last Synced: 2024-10-13T16:32:24.665Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://codesandbox.io/s/zealous-goldstine-m0994
- Size: 335 KB
- Stars: 28
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# local-storage-hook
> React Hook for Local Storage
[![NPM](https://img.shields.io/npm/v/local-storage-hook.svg)](https://www.npmjs.com/package/local-storage-hook) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
## Install
```bash
npm add local-storage-hook
```## Signature
```jsx
const [localState, setLocalState] = useLocalStorage(key, defaultValue);
```## Usage
```jsx
import React from 'react'import useLocalStorage from 'local-storage-hook'
export default () => {
// const [localState, setLocalState] = useLocalStorage(key, defaultValue);
const [login, setLogin] = useLocalStorage("login", false);return (
Hello
);
}
```
[Example Link](https://codesandbox.io/s/zealous-goldstine-m0994)## License
GPLV3 © [akash-joshi](https://github.com/akash-joshi)