useLocalStorage()
Home > @gooddata/sdk-ui > useLocalStorage
useLocalStorage() function
Hook for using local storage. Ideally, you want to keep initial value immutable to avoid unnecessary re-renders.
Signature:
useLocalStorage: <T>(key: string, initialValue: T) => [T, (value: T) => void]
Parameters
| Parameter | Type | Description | 
|---|---|---|
| key | string | |
| initialValue | T | 
Returns:
[T, (value: T) => void]