Skip to content

Instantly share code, notes, and snippets.

@juliandavidmr
Created August 9, 2023 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliandavidmr/55fc7eed6107f06a0e12b683aeffefb2 to your computer and use it in GitHub Desktop.
Save juliandavidmr/55fc7eed6107f06a0e12b683aeffefb2 to your computer and use it in GitHub Desktop.
2022 Demo.tsx
// <Demo> must be enclosed in <ExperimentLayout>.
//
// Example:
// <ExperimentLayout>
// <Demo />
// </ExperimentLayout>
const Demo = () => {
const { isControlActive } = useExperiment();
const variantId = 'test_demo_experiment'; // TODO: update with real experiment flag key.
const abIsControl = isControlActive(variantId);
return abIsControl ? <h1>Control enabled</h1> : <h2>Variant enabled</h2>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment