Skip to main content

configuration/ComPilotProvider

Component

ComPilotProvider()

ComPilotProvider(props): Element

ComPilotProvider is a React Context Provider that provides the ComPilot configuration to the rest of the application.

Parameters

props: ComPilotProviderProps

The props of the ComPilotProvider component.

Returns

Element

Example

Basic

import { ComPilotProvider } from "@compilot/react-sdk";
import { config } from "./config";

const App = () => {
return (
<ComPilotProvider config={config}>
<MyApp />
</ComPilotProvider>
);
};

With AutoLoader disabled

import { ComPilotProvider } from "@compilot/react-sdk";
import { config } from "./config";

const App = () => {
return (
<ComPilotProvider config={config} autoLoad={false}>
<MyApp />
</ComPilotProvider>
);
};

PropTypes

ComPilotProviderProps

ComPilotProviderProps: {autoLoad: boolean;children: React.ReactNode;config: Config; }

The props type of ComPilotProvider.

Type declaration

autoLoad?

optional autoLoad: boolean

Whether to automatically load the ComPilot SDK resources.

Default
true
children

children: React.ReactNode

The children components to render.

config

config: Config

The ComPilot configuration object.

See

Config