useFeatureFlag

Retrieve the value of a LaunchDarkly feature flag.

Reference

const value = useFeatureFlag(key, defaultValue?)

Parameters

  • key: The key of the feature flag to retrieve the value for.
  • defaultValue: An optional value to return if the feature flag is not available.

Returns

The feature flag value or the defaultValue if the feature flag is not available.

Usage

If the show-characters feature flag is not available, true will be returned.

import { useFeatureFlag } from "@squide/firefly";

const value = useFeatureFlag("show-characters", true);