Skip to content

useIsLivePreviewActive

useIsLivePreviewActive(): boolean

Defined in: packages/react/src/livePreview/useIsLivePreviewActive.ts:25

Whether this page is a live-preview surface: the session-verified LIVE_PREVIEW_COOKIE marker holds "1", AND the page asked to preview — ?vexLivePreview=1 is in the URL, or the window carries LIVE_PREVIEW_WINDOW_NAME (written by LivePreviewProvider the first time preview activated in this window, so it survives navigations that drop the param).

false during the server render and hydration, then the browser’s answer, so a page reading it stays statically prerenderable and hydrates without a mismatch. Advisory: picking a draft-reading query on true is safe because every draft read is gated server-side by its own readDrafts check.

boolean

true once the cookie and a preview request are both present.