Skip to content

hydrate · Next.js client API

function hydrate<TSchema>(options): void;

Restores serializable snapshots into hydratable entities declared in a schema.

Use this with a client-safe container and the snapshot received through a Client Component prop.

Type Parameter

TSchema extends Readonly<Record<string, Token<Hydratable<Serializable>>>>

Parameter Type Description

options

HydrateOptions<TSchema>

Client container, matching schema, and server snapshot.

void

hydrate({
container: clientContainer,
schema: hydration,
snapshot,
});

Error when the schema contains a missing token or the snapshot is missing a required key.