dehydrate

function
persistence/persist.ts:375
signature
dehydrate(store, options): string

Serializes a store for handoff, for example from a server render to the client.

Parameters

NameTypeDescription
storePick<PersistableStore, "getState">
NameTypeDescription
optionsPick<PersistOptions, "version" | "slices" | "onError" | "maxNodes">

Returns

string, The payload, or "" when the state exceeded PersistOptions.maxNodes. An empty handoff hydrates as "nothing to restore", so the client starts from its defaults rather than from part of the server's state. The loss is reported through onError either way.