Content
useSessionStorage
A React hook that allows you to persist data across browser sessions.
useSessionStorage
Usage
API
useSessionStorage
Parameters
Name | Type | Description |
---|---|---|
key | string | The key of the item to be stored in session storage. |
initialValue | T | The initial value to be used if the item does not exist in session storage. |
Returns
Name | Type | Description |
---|---|---|
value | T | The value of the item in session storage. |
setValue | (value: T) => void | A function that sets the value of the item in session storage. |