Function createLDReactProvider

  • Creates a new LaunchDarkly React provider, creating the client internally.

    By default the client is started immediately (before the provider mounts). Pass deferInitialization: true in options to opt out of auto-start and call client.start() yourself via useLDClient().

    Parameters

    • clientSideID: string

      launchdarkly client-side ID

    • context: LDContext

      the initial LaunchDarkly context

    • Optional options: LDReactProviderOptions

      optional provider and client options

      Optional

    Returns React.FC<{
        children: React.ReactNode;
    }>

    The LaunchDarkly React Client provider.

    Example

    import { createLDReactProvider } from '@launchdarkly/react-sdk';

    const LDProvider = createLDReactProvider('your-client-side-id', { kind: 'user', key: 'user-key' });

    function Root() {
    return (
    <LDProvider>
    <App />
    </LDProvider>
    );
    }

Generated using TypeDoc