1 import { useVariant as useUnleashVariant } from '@unleash/proxy-client-react';
3 import type { FeatureFlagVariant, FeatureFlagsWithVariant } from './UnleashFeatureFlagsVariants';
7 * @param name - Feature flag name
8 * @description Returns the Unleash variant value based on the feature flag name
9 * 1. In `UnleashFeatureFlagsVariants.ts` register the flag name your want to add variants on in `FLAG_VARIANTS` const
10 * 2. In the same file add feature flag variant condition to the `UnleashVariant` type
11 * 3. Use the `useVariant` hook to get your flag variant value
13 function useVariant<TFlagName extends FeatureFlagsWithVariant>(name: TFlagName): FeatureFlagVariant<TFlagName> {
14 const variant = useUnleashVariant(name) as FeatureFlagVariant<TFlagName>;
19 export default useVariant;