hydrate

1function hydrate(config, initialState?): HydrateResult;

Defined in: account-kit/core/src/hydrate.ts:37

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

Example

1import { hydrate, cookieToInitialState } from "@account-kit/core";
2import { config } from "./config";
3
4const initialState = cookieToInitialState(document.cookie);
5const { onMount } = hydrate(config, initialState);
6// call onMount once your component has mounted

Parameters

ParameterTypeDescription

config

AlchemyAccountsConfig

the config containing the client store

initialState?

StoredState

optional param detailing the initial ClientState

Returns

HydrateResult

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