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

https://github.com/progfay/use-session-storage

React hooks to manage state that works with `sessionStorage`
https://github.com/progfay/use-session-storage

react react-hooks sessionstorage

Last synced: 3 months ago
JSON representation

React hooks to manage state that works with `sessionStorage`

Awesome Lists containing this project

README

        

## `useSessionStorage(key)` hooks

__⚠️ This code has not yet been published in npm registry.__

```tsx
import {
setSessionStorageItem,
useSessionStorage,
} from '@progfay/use-session-storage'

const KEY = 'RANDOM_VALUE'

const ComponentA = () => (
setSessionStorageItem(Math.random().toFixed(10))}>
Set random value for sessionStorage

)

const ComponentB = () => {
const randomValue = useSessionStorage(KEY)
return (


random value in sessionStorage: {randomValue}


)
}

const App = () => (
<>


>
)
```