# hydrate | @account-kit/core

> Overview of the hydrate function from @account-kit/core

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

{/* This file is auto-generated by TypeDoc. Do not edit manually. */}

```ts
function hydrate(config, initialState?): HydrateResult;
```

Defined in: [account-kit/core/src/hydrate.ts:37](https://github.com/alchemyplatform/aa-sdk/blob/main/account-kit/core/src/hydrate.ts#L37)

Will hydrate the client store with the provided initial state if one is provided.

## Example

```ts
import { hydrate, cookieToInitialState } from "@account-kit/core";
import { config } from "./config";

const initialState = cookieToInitialState(document.cookie);
const { onMount } = hydrate(config, initialState);
// call onMount once your component has mounted
```

## Parameters

<table>
  <thead>
    <tr>
      <th align="left">Parameter</th>
      <th align="left">Type</th>
      <th align="left">Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `config`
      </td>

      <td>
        [`AlchemyAccountsConfig`](../type-aliases/AlchemyAccountsConfig)
      </td>

      <td>
        the config containing the client store
      </td>
    </tr>

    <tr>
      <td>
        `initialState?`
      </td>

      <td>
        [`StoredState`](../type-aliases/StoredState)
      </td>

      <td>
        optional param detailing the initial ClientState
      </td>
    </tr>

  </tbody>
</table>

## Returns

`HydrateResult`

an object containing an onMount function that can be called when your component first renders on the client