Capxul Docs
How-to guides

Inject an existing CapxulClient

Use a client created outside React while keeping lifecycle ownership explicit.

Use injected-client mode when another boundary already creates the Core SDK client, such as a test harness or renderer host:

import { CapxulProvider } from "@capxul/sdk-react";

export function Harness({ client }: { client: CapxulClient }) {
  return (
    <CapxulProvider client={client}>
      <Scenario />
    </CapxulProvider>
  );
}

The provider is ready immediately. The creator still owns client cleanup; injected mode never closes it. Supply exactly one of client or publishableKey, not both.

Create production clients through the public factory documented in the Core SDK reference. Keep workspace-only adapter and testing subpaths out of installable examples.