PromucFlow_constructor/app/client/src/utils/hooks/useFeatureFlag.ts

12 lines
397 B
TypeScript
Raw Normal View History

import { useSelector } from "react-redux";
import type { FeatureFlag } from "@appsmith/entities/FeatureFlag";
import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors";
export function useFeatureFlag(flagName: FeatureFlag): boolean {
const flagValues = useSelector(selectFeatureFlags);
if (flagName in flagValues) {
return flagValues[flagName];
}
return false;
}