diff --git a/packages/ldclient-react/src/context.ts b/packages/ldclient-react/src/context.ts index 333365ca..74823259 100644 --- a/packages/ldclient-react/src/context.ts +++ b/packages/ldclient-react/src/context.ts @@ -4,7 +4,7 @@ import { LDClient, LDFlagSet } from 'ldclient-js'; /** * The LaunchDarkly context stored in the Provider state and passed to consumers. */ -interface LDContext { +export interface LDContext { /** * Contains all flags from LaunchDarkly. This object will always exist but will be empty {} initially * until flags are fetched from the LaunchDarkly servers. @@ -20,5 +20,6 @@ interface LDContext { ldClient?: LDClient; } -const { Provider, Consumer } = createContext({ flags: {}, ldClient: undefined }); -export { Provider, Consumer, LDContext }; +export const LDReactContext = createContext({ flags: {}, ldClient: undefined }); +export const Provider = LDReactContext.Provider; +export const Consumer = LDReactContext.Consumer; diff --git a/packages/ldclient-react/src/index.ts b/packages/ldclient-react/src/index.ts index de9e6de4..7fb0045b 100644 --- a/packages/ldclient-react/src/index.ts +++ b/packages/ldclient-react/src/index.ts @@ -1,4 +1,5 @@ +import { LDReactContext } from './context'; import withLDProvider from './withLDProvider'; import withLDConsumer from './withLDConsumer'; -export { withLDProvider, withLDConsumer }; +export { LDReactContext, withLDProvider, withLDConsumer };