import React from 'react';
import { Optional } from 'backend-api/models';
import { IFeatureFlagsContext } from 'common-v2/types';

export const FeatureFlagsContext = React.createContext<Optional<IFeatureFlagsContext>>(undefined);

export const FeatureFlagsContextProvider: React.FC<IFeatureFlagsContext> = React.memo(({ treatments, children }) => (
  <FeatureFlagsContext.Provider value={{ treatments }}>{children}</FeatureFlagsContext.Provider>
));
