useLocalStorage
Manages a state variable synchronized with local storage.
useLocalStorage
Installation
Usage
API
useLocalStorage
Parameters
| Name | Type | Description |
|---|---|---|
| key | string | The key for the local storage item. |
| initialValue | T | The initial value for the state variable. |
Returns
| Name | Type | Description |
|---|---|---|
| storedValue | T | The current value synchronized with local storage. |
| setValue | (value: T) => void | A function to update the state and sync it with local storage. |