Merge branch 'fix-unauth' into 'main'
[ProtonMail-WebClient.git] / packages / features / useFeature.ts
blob765a59dbc5a0abdfbaa3f7214abae4faa5c209e4
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>;
9 };
11 export default useFeature;