The LaunchDarkly client interface for React.

Hierarchy

Properties

logger: LDLogger

Methods

  • Parameters

    Returns void

  • Returns LDFlagSet

  • Parameters

    • key: string
    • defaultValue: boolean

    Returns boolean

  • Parameters

    • key: string
    • defaultValue: boolean

    Returns LDEvaluationDetailTyped<boolean>

  • Returns Promise<void>

  • Returns Promise<{
        error?: Error;
        result: boolean;
    }>

  • Returns undefined | LDContextStrict

  • Returns the error that caused initialization to fail, if any. Only set when getInitializationState() returns 'failed'.

    Returns undefined | Error

  • Returns the initialization state of the client. This function is helpful to determine whether LDClient can be used to evaluate flags on initial component render.

    Returns "initializing" | "failed" | "timeout" | "complete"

    The initialization state of the client.

    See

    LDWaitForInitializationResult for the possible values and their meaning

  • Returns whether the client is ready to evaluate flags. This is true when the client has completed initialization (successfully or with failure), or when bootstrap data was provided.

    Returns boolean

    Whether the client can evaluate flags.

  • Parameters

    • key: string
    • defaultValue: unknown

    Returns unknown

  • Parameters

    • key: string
    • defaultValue: unknown

    Returns LDEvaluationDetailTyped<unknown>

  • Parameters

    • key: string
    • defaultValue: number

    Returns number

  • Parameters

    • key: string
    • defaultValue: number

    Returns LDEvaluationDetailTyped<number>

  • Parameters

    • key: string
    • callback: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]
            Rest

          Returns void

    Returns void

  • Parameters

    • key: string
    • callback: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]
            Rest

          Returns void

    Returns void

  • Subscribes to context changes triggered by identify(). The callback is invoked after each successful identify() call with the new resolved context.

    Parameters

    • callback: ((context) => void)

      Function called with the new context after each successful identify.

    Returns (() => void)

    An unsubscribe function. Call it to stop receiving notifications.

      • (): void
      • Subscribes to context changes triggered by identify(). The callback is invoked after each successful identify() call with the new resolved context.

        Returns void

        An unsubscribe function. Call it to stop receiving notifications.

  • Subscribes to initialization status changes triggered when the client is initialized.

    Parameters

    • callback: ((result) => void)

      Function called with the initialization result.

    Returns (() => void)

    An unsubscribe function. Call it to stop receiving notifications.

      • (): void
      • Subscribes to initialization status changes triggered when the client is initialized.

        Returns void

        An unsubscribe function. Call it to stop receiving notifications.

  • Sets the connection mode for the SDK's data system.

    When set, this mode is used exclusively, overriding all automatic mode selection (including setStreaming). The setStreaming state is not modified -- setConnectionMode acts as a higher-priority override.

    Pass undefined (or call with no arguments) to clear the override and return to automatic mode selection.

    This method requires the FDv2 data system (dataSystem option). If FDv2 is not enabled, the call logs a warning and has no effect.

    This method is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is in early access. If you want access to this feature please join the EAP. https://launchdarkly.com/docs/sdk/features/data-saving-mode

    Parameters

    • Optional mode: FDv2ConnectionMode

      The connection mode to use, or undefined to clear the override.

      Optional

    Returns void

  • Specifies whether or not to open a streaming connection to LaunchDarkly for live flag updates.

    If this is true, the client will always attempt to maintain a streaming connection; if false, it never will. If you leave the value undefined (the default), the client will open a streaming connection if you subscribe to "change" or "change:flag-key" events (see LDClient.on).

    This can also be set as the streaming property of LDOptions.

    Parameters

    • Optional streaming: boolean
      Optional

    Returns void

  • Internal

    Returns whether flag keys should be converted to camelCase in useFlags(). Defaults to true when absent.

    Returns boolean

    Whether flag keys should be converted to camelCase.

    Remarks

    NOTE: This method is only used by useFlags() hook.

    Deprecated

    This method is deprecated and will be removed in a future major version.

  • Parameters

    • key: string
    • defaultValue: string

    Returns string

  • Parameters

    • key: string
    • defaultValue: string

    Returns LDEvaluationDetailTyped<string>

  • Parameters

    • key: string
    • Optional data: any
      Optional
    • Optional metricValue: number
      Optional

    Returns void

  • Parameters

    • key: string
    • Optional defaultValue: any
      Optional

    Returns any

  • Parameters

    • key: string
    • Optional defaultValue: any
      Optional

    Returns LDEvaluationDetail

Generated using TypeDoc