Transforms a set of flags so that their keys are camelCased. This function ignores
flag keys which start with $
.
A mapping of flag keys and their values
A transformed LDFlagSet
with camelCased flag keys
Contains default values for the reactOptions
object.
This is an async function which initializes LaunchDarkly's JS SDK (launchdarkly-js-client-sdk
)
and awaits it so all flags and the ldClient are ready before the consumer app is rendered.
The difference between withLDProvider
and asyncWithLDProvider
is that withLDProvider
initializes
launchdarkly-js-client-sdk
at componentDidMount. This means your flags and the ldClient are only available after
your app has mounted. This can result in a flicker due to flag changes at startup time.
asyncWithLDProvider
initializes launchdarkly-js-client-sdk
at the entry point of your app prior to render.
This means that your flags and the ldClient are ready at the beginning of your app. This ensures your app does not
flicker due to flag changes at startup time.
asyncWithLDProvider
accepts a config object which is used to initialize launchdarkly-js-client-sdk
.
asyncWithLDProvider
does not support the deferInitialization
config option because asyncWithLDProvider
needs
to be initialized at the entry point prior to render to ensure your flags and the ldClient are ready at the beginning
of your app.
It returns a provider which is a React FunctionComponent which:
The configuration used to initialize LaunchDarkly's JS SDK
useFlags
is a custom hook which returns all feature flags. It uses the useContext
primitive
to access the LaunchDarkly context set up by withLDProvider
. As such you will still need to
use the withLDProvider
HOC at the root of your app to initialize the React SDK and populate the
context with ldClient
and your flags.
All the feature flags configured in your LaunchDarkly project
useLDClient
is a custom hook which returns the underlying LaunchDarkly JavaScript SDK client object.
Like the useFlags
custom hook, useLDClient
also uses the useContext
primitive to access the LaunchDarkly
context set up by withLDProvider
. You will still need to use the withLDProvider
HOC
to initialise the react sdk to use this custom hook.
The launchdarkly-js-client-sdk
LDClient
object
Provides the LaunchDarkly client initialization error, if there was one.
The launchdarkly-js-client-sdk
LDClient
initialization error
withLDConsumer is a function which accepts an optional options object and returns a function which accepts your React component. This function returns a HOC with flags and the ldClient instance injected via props.
If you need only the ldClient
instance and not flags, then set { clientOnly: true }
to only pass the ldClient prop to your component. Defaults to { clientOnly: false }
.
A HOC with flags and the ldClient
instance injected via props
withLDProvider
is a function which accepts a config object which is used to
initialize launchdarkly-js-client-sdk
.
This HOC handles passing configuration to the LDProvider
, which does the following:
launchdarkly-js-client-sdk
initialize on componentDidMount
The difference between withLDProvider
and asyncWithLDProvider
is that withLDProvider
initializes
launchdarkly-js-client-sdk
at componentDidMount
. This means your flags and the ldClient are only available after
your app has mounted. This can result in a flicker due to flag changes at startup time.
asyncWithLDProvider
initializes launchdarkly-js-client-sdk
at the entry point of your app prior to render.
This means that your flags and the ldClient are ready at the beginning of your app. This ensures your app does not
flicker due to flag changes at startup time.
The configuration used to initialize LaunchDarkly's JS SDK
A function which accepts your root React component and returns a HOC
withLDProvider
is a function which accepts a config object which is used to
initialize launchdarkly-js-client-sdk
.
This HOC handles passing configuration to the LDProvider
, which does the following:
launchdarkly-js-client-sdk
initialize on componentDidMount
The difference between withLDProvider
and asyncWithLDProvider
is that withLDProvider
initializes
launchdarkly-js-client-sdk
at componentDidMount
. This means your flags and the ldClient are only available after
your app has mounted. This can result in a flicker due to flag changes at startup time.
asyncWithLDProvider
initializes launchdarkly-js-client-sdk
at the entry point of your app prior to render.
This means that your flags and the ldClient are ready at the beginning of your app. This ensures your app does not
flicker due to flag changes at startup time.
A function which accepts your root React component and returns a HOC
Generated using TypeDoc
Configuration object used to initialize LaunchDarkly's JS client asynchronously.