Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/ldclient-react/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -20,5 +20,6 @@ interface LDContext {
ldClient?: LDClient;
}

const { Provider, Consumer } = createContext<LDContext>({ flags: {}, ldClient: undefined });
export { Provider, Consumer, LDContext };
export const LDReactContext = createContext<LDContext>({ flags: {}, ldClient: undefined });
export const Provider = LDReactContext.Provider;
export const Consumer = LDReactContext.Consumer;
3 changes: 2 additions & 1 deletion packages/ldclient-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LDReactContext } from './context';
import withLDProvider from './withLDProvider';
import withLDConsumer from './withLDConsumer';

export { withLDProvider, withLDConsumer };
export { LDReactContext, withLDProvider, withLDConsumer };