@launchdarkly/react-sdk - v4.2.3
    Preparing search index...

    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

      • Optionaloptions: LDReactProviderOptions

        optional provider and client options

      Returns FC<{ children: ReactNode }>

      The LaunchDarkly React Client provider.

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

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

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