VolProvider
Every atom must be rendered inside <VolProvider>.
import { VolProvider } from "@vol/atoms";
<VolProvider apiKey="vol_live_…" baseUrl="https://vol.example.com/api" defaultCase="papers"> {children}</VolProvider>;| Prop | Type | Description |
|---|---|---|
client |
VolClient |
Preconfigured client. When set, apiKey, baseUrl and accessToken are ignored. |
apiKey |
string |
Integration key (X-API-Key). |
baseUrl |
string |
API base without /v1. Default "/api". |
accessToken |
string | () => string | Promise<string> |
Supabase session token or a getter. |
defaultCase |
CaseId |
Case used by atoms that do not receive case. |
children |
ReactNode |
The client is memoised on these props. If you pass an accessToken function, keep it stable
(useCallback) to avoid recreating the client.
With Supabase
Section titled “With Supabase”const getToken = useCallback(async () => (await supabase.auth.getSession()).data.session?.access_token, []);<VolProvider accessToken={getToken} defaultCase="cordis">…</VolProvider>;useVolClient()— theVolClientinstance, to call any SDK method.useVol()—{ client, defaultCase }.useCase(case?)— resolves a case from a prop or the provider default (throws if neither is set).