Skip to main content

CHP Context

Some CHP components are stateful, and will integrate with the CHP API. In order to function correctly this requires data such as the base URL (which may differ per environment), and your tenant identifier.

This is achieved by importing and using the <CHPProvider> component. This should be placed in your React component tree above all CHP components (for example, in your App.tsx).

Note that CHP Components will throw an error if the context is not provided

Props

NameDescription
baseUrlThe URL where the CHP API you are interacting with can be found, for example https://chp.falsepill.com for non-prod
tenantIdYour unique tenant identifier, as provided to you by the CHP team
accessTokenJWT access token required to authenticate with the CHP APIs. See the authentication docs for more information.

Example

App.tsx
import { CHPProvider } from '@truepill/chp-components';

<CHPProvider baseUrl="http://chp.falsepill.com" tenantId="chp-dev-tenant-a" accessToken="some-access-token">
{/* Rest of your app, including CHP Components */}
</CHPProvider>