# Local Storage

TypeScript source: `utils/local-storage.ts`

## Types

### LocalStorageItems

Source: `utils/local-storage.ts:4`

```ts
"topicList" | "analyticsEnabled" | "theme"
```

Local storage keys managed by the common viewer package.

## Functions

### getItemFromLocalStorage

Source: `utils/local-storage.ts:12`

```ts
(key: LocalStorageItems) => T | null
```

Reads and parses a JSON value from local storage.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `key` | `LocalStorageItems` | Known local storage key. |

#### Returns

Parsed value, or `null` when the key is not present.

### removeItemFromLocalStorage

Source: `utils/local-storage.ts:37`

```ts
(key: LocalStorageItems) => void
```

Removes a managed key from local storage.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `key` | `LocalStorageItems` | Known local storage key. |

### setItemToLocalStorage

Source: `utils/local-storage.ts:28`

```ts
(key: LocalStorageItems, value: unknown) => void
```

Serializes and stores a value in local storage.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `key` | `LocalStorageItems` | Known local storage key. |
| `value` | `unknown` | Value to serialize. |
