Socket
Socket
Sign inDemoInstall

@iteam/hooks

Package Overview
Dependencies
Maintainers
6
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iteam/hooks - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "@iteam/hooks",
"version": "0.3.0",
"version": "0.3.1",
"main": "dist/hooks.cjs.js",

@@ -5,0 +5,0 @@ "module": "dist/hooks.esm.js",

@@ -92,1 +92,33 @@ # Iteam Hooks

```
### useLocalStorage
Get and set values in `localStorage`
```js
useLocalStorage(key: string, initialValue?: any): [string, (newValue: string) => void]
```
#### Example
```js
import React from 'react'
import { useLocalStorage } from '@iteam/hooks'
export const Storage = ({ initialValue }) => {
const [value, setValue] = useLocalStorage('storedValue', initialValue)
return (
<div>
{value ? value : 'no value ;('}
<label htmlFor="store">Update store value</label>
<input
id="store"
onChange={e => setValue(e.currentTarget.value)}
type="text"
value={value}
/>
</div>
)
}
```
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