# AdaptablePersistStateFunction

Canonical page: https://www.adaptabletools.com/docs/reference/adaptablepersiststatefunction

Function that handles persisting state to storage systems (localStorage, server, etc.).
Called after `saveState()` to store the prepared state.

This is the place to apply any custom storage format (envelope, compression, encryption, etc.); the matching `loadState()` is expected to undo it.

```ts title="TypeScript"
export interface AdaptablePersistStateFunction 
```

## Calls

```ts title="TypeScript"
(state: AdaptablePersistentState, adaptableStateFunctionConfig: AdaptableStateFunctionConfig): Promise<unknown>;
```

###### Parameters

| Parameter | Type |
| --- | --- |
| state | [`AdaptablePersistentState`](https://www.adaptabletools.com/docs/reference/adaptablepersistentstate.md) |
| adaptableStateFunctionConfig | [`AdaptableStateFunctionConfig`](https://www.adaptabletools.com/docs/reference/adaptablestatefunctionconfig.md) |

###### Returns

`Promise<unknown>`
