1 import type { FeatureCode } from './interface';
2 import type { FeatureContextValue } from './useFeatures';
3 import useFeatures from './useFeatures';
5 const useFeature = <FeatureValue = any>(code: FeatureCode, prefetch = true) => {
6 // Forcing type, not sure how to type a generic array
7 const { featuresFlags } = useFeatures([code], prefetch);
8 return featuresFlags[0] as FeatureContextValue<FeatureValue>;
11 export default useFeature;