Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Zustand · Pipe

skipHydration

skipHydration is a Zustand persist option that prevents automatic hydration when a store is initialized. Enable it when the application needs to call rehydrate() at a controlled time, such as during SSR.

How it works

skipHydration changes persist middleware startup behavior: it prevents the initial storage read and merge. The application must later invoke the store's persist.rehydrate() method, which is especially useful when an SSR app needs to control when persisted client state enters the store.

Syntax

skipHydration: boolean | undefined

Parameters

NameTypeDescription
skipHydrationboolean | undefinedBoolean option controlling whether the initial persist hydration is skipped; the documented default is undefined.

Key points

  • Persist normally reads stored state during startup; skipHydration opts out of that initial operation.
  • The option is intended for applications that need to choose the exact point at which persisted state is first loaded.
  • Use skipHydration: true to suppress the middleware's automatic first hydration call.
  • Server-rendered applications are a documented scenario for delaying the first hydration.
  • Once ready, manually begin the process through the store's persist.rehydrate() method.

Common mistakes

  • Setting this option means persisted data is not loaded automatically; forgetting to call rehydrate() leaves the store at its initial state.
  • Manual rehydration is required after opting out of automatic initialization.

Example: Manually rehydrate a persisted store

import { create } from 'zustand'
import { persist } from 'zustand/middleware'

type State = {
  count: number
  increment: () => void
}

export const useStore = create<State>()(
  persist(
    (set) => ({
      count: 0,
      increment: () => set((state) => ({ count: state.count + 1 })),
    }),
    { name: 'counter', skipHydration: true },
  ),
)

useStore.persist.rehydrate()

Creates a persisted store without hydrating during initialization, then explicitly starts rehydration.

When to use it

Server-rendered applications

The server and client must coordinate when persisted browser state enters a store.

Controlled startup sequencing

An app must delay the storage read until a later lifecycle point or event.

Deferred persistence loading

The application needs to ensure initialization completes before persisted data is merged.

Interview questions

QWhat does skipHydration do?

skipHydration is a persist option that prevents the middleware's first hydration call during store initialization. The application then controls the timing by invoking useStore.persist.rehydrate().

Follow-up: Why is this useful with SSR? It lets the application defer the client-side persisted-state read until an appropriate point, helping control the initial hydration sequence.

QHow do you enable skipHydration?

The option is boolean and is enabled by setting skipHydration: true inside the persist configuration. Without it, the store hydrates on initialization by default.

Follow-up: What happens if it is false? The normal initialization hydration occurs, so no explicit first rehydration call is needed.

QHow is hydration started manually?

After creating the store, call its persist API: await useBoundStore.persist.rehydrate(). This explicitly triggers retrieval of persisted data and its merge into the current state.

Follow-up: How does storage type affect hydration? Synchronous storage hydrates synchronously, while asynchronous storage hydrates asynchronously.

  • persist
  • rehydrate
  • persisting store data
  • SSR and Hydration

Source: Persisting store data. Checked 2026-10-15.