Type Parameters
- T extends IntrinsicAttributes = {}
Returns ((WrappedComponent: React.ComponentType<T>) => React.ComponentType<T>)
A function which accepts your root React component and returns a HOC
- (WrappedComponent): React.ComponentType<T>
Parameters
- WrappedComponent: React.ComponentType<T>
Returns React.ComponentType<T>
withLDProvideris a function which accepts a config object which is used to initializelaunchdarkly-js-client-sdk.This HOC handles passing configuration to the
LDProvider, which does the following:launchdarkly-js-client-sdkinitialize oncomponentDidMountThe difference between
withLDProviderandasyncWithLDProvideris thatwithLDProviderinitializeslaunchdarkly-js-client-sdkatcomponentDidMount. 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.asyncWithLDProviderinitializeslaunchdarkly-js-client-sdkat 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.