hydrate

function
persistence/persist.ts:102
signature
hydrate(options): Promise<Hydration>

Reads persisted state, ready to seed a store.

Parameters

NameTypeDescription
optionsPersistOptions & { source?: string }

Returns

Promise<Hydration>

Example

example
const hydration = await hydrate({ key: 'app', adapter, version: 3 });
const store = createStore({
  name: 'App',
  reducer: withHydration({ todos: todosSpec }, hydration),
});