Configuration object used to initialise LaunchDarkly's JS client.

interface ProviderConfig {
    clientSideID: string;
    context?: LDContext;
    deferInitialization?: boolean;
    flags?: LDFlagSet;
    ldClient?: LDClient | Promise<undefined | LDClient>;
    options?: LDOptions;
    reactOptions?: LDReactOptions;
    timeout?: number;
    user?: LDContext;
}

Properties

clientSideID: string

Your project and environment specific client side ID. You can find this in your LaunchDarkly portal under Account settings. This is the only mandatory property required to use the React SDK.

context?: LDContext

A LaunchDarkly context object. If unspecified, an anonymous context with kind: 'user' will be created and used.

deferInitialization?: boolean

If set to true, the ldClient will not be initialized until the context prop has been defined.

flags?: LDFlagSet

If specified, launchdarkly-react-client-sdk will only listen for changes to these flags. Otherwise, all flags will be requested and listened to. Flag keys must be in their original form as known to LaunchDarkly rather than in their camel-cased form.

ldClient?: LDClient | Promise<undefined | LDClient>

Optionally, the ldClient can be initialized outside of the provider and passed in, instead of being initialized by the provider.

Note: it should only be passed in when it has emitted the 'ready' event when using withLDProvider, to ensure that the flags are properly set. If using with asyncWithLDProvider, then it will wait internally, so it is not required that the client have emitted the 'ready' event.

options?: LDOptions

LaunchDarkly initialization options. These options are common between LaunchDarkly's JavaScript and React SDKs.

reactOptions?: LDReactOptions

Additional initialization options specific to the React SDK.

options

timeout?: number

The amount of time, in seconds, to wait for initialization before rejecting the promise. Using a large timeout is not recommended. If you use a large timeout and await it, then any network delays will cause your application to wait a long time before continuing execution. This gets passed to the underlying Javascript SDK waitForInitialization function.

user?: LDContext

The user property will be removed in a future version, please update your code to use context instead.