useFeatureFlag

retrieve feature flag value

ArgumentList:

  • 1.flagName

     name of the feature flag

Returns:

 The value of the feature flag.

Examples

Basic Usage

This hook retrieves the value of a feature flag. Must be used within a <FeatureFlagProvider>.

// import { useFeatureFlag } from '@octanner/prism-utilities';
() => {
const featureFlagClient = React.useMemo(
() => new LaunchDarklyClient(LAUNCHDARKLY_CLIENT_ID),
[],
);
const SomeComponent = () => {
const value = useFeatureFlag('maintenance-redirect');
return <div>Value: {value}</div>
}
return (
<FeatureFlagProvider client={featureFlagClient}>
<SomeComponent />
</FeatureFlagProvider>
)
};