Experiment Reporting
Export reference for React experiment-exposure reporting
import {
type ExperimentExposure,
ExperimentExposureReporter,
ExperimentsProvider,
useExperimentExposure,
useExperimentsContext,
} from "@octopus-energy/flags/reporting";This entry point requires the React peer dependency. For setup and usage, see the experiment-exposure reporting guide.
ExperimentsProvider
React client component that provides a reporting emitter to descendants.
emit(exposure) receives an ExperimentExposure. Each experiment/variant pair
is emitted at most once for the provider's lifetime.
ExperimentsProviderProp
Type
ExperimentsProviderPropsProp
Type
useExperimentExposure
React client hook that reports a readonly array of ExperimentExposure values
through the nearest ExperimentsProvider.
useExperimentExposureProp
Type
ExperimentExposureReporter
React client component for exposures derived in a Server Component. It accepts
a readonly ExperimentExposure array and emits nothing when the array is empty.
ExperimentExposureReporterProp
Type
ExperimentExposureReporterPropsProp
Type
useExperimentsContext
React client hook that returns the nearest reporting context. It throws when
called outside ExperimentsProvider.
useExperimentsContextProp
Type
ExperimentsContextValueProp
Type
ExperimentExposure
The exposure object passed to the reporting APIs.
ExperimentExposureProp
Type