Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @superflag/client-react

Index

Type aliases

TFeatureFlags<KEYS>: Partial<Record<KEYS, boolean>>

Type parameters

  • KEYS: string

TIdentifierFunction<PROPS>: (props: TIdentifyParams<PROPS>) => void

Type parameters

  • PROPS: string = any

Type declaration

TIdentifyParams<PROPS>: Record<PROPS, string | boolean | number | undefined>

Type parameters

  • PROPS: string = string

Variables

DefaultFeatureFlagCacheKey: "featureFlags" = 'featureFlags'

the default localStorage key to use when caching the resolved feature flags

FeatureFlagProviderRaw: React.FC<IFeatureFlagContext<any>> = ...

Functions

  • FeatureFlagGate<KEYS>(__namedParameters: PropsWithChildren<FeatureFlagGateProps<KEYS>>): JSX.Element
  • Type parameters

    • KEYS: string

    Parameters

    • __namedParameters: PropsWithChildren<FeatureFlagGateProps<KEYS>>

    Returns JSX.Element

  • FeatureFlagSwitch<KEYS>(__namedParameters: PropsWithChildren<FeatureFlagSwitchProps<KEYS>>): JSX.Element
  • MockFeatureFlagProvider<KEYS, PROPS>(__namedParameters: PropsWithChildren<Partial<IFeatureFlagContext<KEYS, PROPS>>>): JSX.Element
  • Helper hook that manages the feature flag state and source lifecycle. This hook calls the init and fetch functions of the source object

    Type parameters

    • KEYS: string

    • PROPS: string

    Parameters

    Returns IFeatureFlagContext<KEYS, PROPS>

    the feature flag context

  • useFeatureFlag<KEYS>(key: KEYS): boolean
  • Fetches a specific feature flag value from the feature flag context

    Type parameters

    • KEYS: string

    Parameters

    • key: KEYS

      the unique key of the flag to fetch

    Returns boolean

  • useFeatureFlags<KEYS>(): Partial<Record<KEYS, boolean>>
  • Fetches the feature flag object from the feature flag context

    Type parameters

    • KEYS: string

    Returns Partial<Record<KEYS, boolean>>

Generated using TypeDoc