Skip to content

feature-content-blocks hooks

The components already use these hooks. Reach for them when you build your own UI on the same data. Open a hook for its options and what it returns.

Reading data

useContentPageRead a content page by path on the client.
import { useContentPage } from "@evolve-storefront/feature-content-blocks/hooks";

Most content pages are fetched on the server — they are the page — so reach for contentPageQueryOptions in a loader first. This is for content that arrives after navigation: a preview pane, a modal, a path that only the client knows.

Not auth-gated: CMS content is public, so isLoading is a safe gate here and !data genuinely means the path has no page.

function useContentPage(path: string, options?: { version?: ContentVersion | undefined; previewId?: string | undefined; enabled?: boolean | undefined; })
OptionTypeDescription
version?ContentVersion
previewId?string
enabled?boolean

Returns A React Query result: data, isPending, error and the rest.

useContentSnippetRead a reusable content snippet by key on the client.
import { useContentSnippet } from "@evolve-storefront/feature-content-blocks/hooks";

Not auth-gated: CMS content is public, so isLoading is a safe gate here and !data genuinely means no snippet is published under that key.

function useContentSnippet(key: string, options?: { version?: ContentVersion | undefined; previewId?: string | undefined; enabled?: boolean | undefined; })
OptionTypeDescription
version?ContentVersion
previewId?string
enabled?boolean

Returns A React Query result: data, isPending, error and the rest.

Other hooks

useContentAudiencesThe audiences the provider was given, or undefined while the session is unknown.
import { useContentAudiences } from "@evolve-storefront/feature-content-blocks/content-audience";
function useContentAudiences(): readonly AudienceType[] | undefined

Returns readonly AudienceType[] | undefined