Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

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)