New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-localstorage-hook

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-localstorage-hook - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

6

package.json
{
"name": "react-localstorage-hook",
"version": "0.0.1",
"version": "0.1.0",
"author": "Kaan Seyitogullari",
"homepage": "https://github.com/kaansey/react-use-local-storage/",
"homepage": "https://github.com/kaansey/react-localstorage-hook",
"repository": {
"type": "git",
"url": "https://github.com/kaansey/react-use-local-storage.git"
"url": "https://github.com/kaansey/react-localstorage-hook"
},

@@ -10,0 +10,0 @@ "keywords": [

# React useLocalStorage
[![npm package][npm-badge]][npm] ![npm-bundle-size] ![Module formats][module-formats] ![npm-download-count]
- It is an custom hook for browser localstorage management.
- For the same localstorage `key` It is consistent across the component (synchronize values between components).
- serializer (JSON.stringify)
- deserializer (JSON.parse)
### Demo
## Features
- It is an custom hook to browser localstorage management.
- For the same localstorage `key` It is consistent across the component (synchronize values between components).
- serializer (JSON.stringify)
- deserializer (JSON.parse)
https://codesandbox.io/s/react-localstorage-hook-yfj5f
### Installation
Add `react-localstorage-hook` dependency
```bash
yarn add react-localstorage-hook
npm install react-localstorage-hook --save
```
### Usage
```js
import useLocalStorage from 'react-localstorage-hook'
```
```js
const [values, setValue] = useLocalStorage(key, initialValue)
```
### Options
| Name | Type | Default | Required | Description |
| ---------------- | ------ | ------- | -------- | --------------------------------------------------------------------------------------------- |
| **key** | String | null | true | The key that will be used when calling localStorage.setItem(key)and localStorage.getItem(key) |
| **initialValue** | any | '' | false | The initial value of the data. |
### License
This project is licensed under the MIT License - see the
[LICENCE.md](./LICENCE.md) file for details
[npm-download-count]: https://img.shields.io/npm/dm/react-localstorage-hook
[npm-bundle-size]: https://img.shields.io/bundlephobia/min/react-localstorage-hook
[npm-badge]: https://img.shields.io/npm/v/react-localstorage-hook?style=flat-square
[npm]: https://www.npmjs.com/package/react-localstorage-hook
[module-formats]: https://img.shields.io/badge/module%20formats-cjs%2C%20esm-green.svg?style=flat-square
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc