VexSessionAdapterProvider
VexSessionAdapterProvider(
props):Element
Defined in: packages/react/src/auth/VexSessionAdapterContext.tsx:101
Mounts the client session adapter for useCanAccessAdminPanel to read on
public pages. Mount once, at the app root, beside VexConfigProvider —
the same root VexConfigProvider already carries access to every route,
public and admin alike (P-004); this is the matching bridge for user.
Parameters
Section titled “Parameters”children
Section titled “children”ReactNode
The subtree that should see it — the whole app, so
every public-page header can gate on useCanAccessAdminPanel.
The session adapter to provide.
Returns
Section titled “Returns”Element
The context provider wrapping props.children.
Example
Section titled “Example”// ~/components/providers/client.tsx ("use client")import { VexSessionAdapterProvider, VexConfigProvider } from "@vexcms/react";import { useSession } from "~/auth/client";import config from "~/vex.config";
function ClientProviders({ children }: { children: React.ReactNode }) { return ( <VexSessionAdapterProvider value={{ useSession: () => { const { data, isPending } = useSession(); return { user: data?.user ?? null, isPending }; }, }} > <VexConfigProvider config={config}>{children}</VexConfigProvider> </VexSessionAdapterProvider> );}