> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# useLocalStorage()

- Package: [@gooddata/sdk-ui](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-ui/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-ui/src/base/react/useLocalStorage.ts

Hook for using local storage. Ideally, you want to keep initial value immutable to avoid unnecessary re-renders.

**Signature:**

```typescript
useLocalStorage: <T>(key: string, initialValue: T) => [T, (value: T) => void]
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| key | string |  |
| initialValue | T |  |

**Returns:**

[T, (value: T) =&gt; void]
