@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
19 lines • 758 B
JavaScript
import { useMemo } from "react";
import { useFeatureFlags } from "./FeatureFlagsContext";
/**
* Hook that returns the value of a feature flag based on its `featureId`.
*
* @dev do not modify this function to make it return a default arbitrary value
* instead of null, this should not be handled at this level.
*
* @param featureId
* @returns a feature flag value or null if the feature flag is not found
* (neither in the remote configuration, in the cache or in the local defaults).
*/
const useFeature = (featureId) => {
const featureFlags = useFeatureFlags();
const value = useMemo(() => featureFlags.getFeature(featureId), [featureFlags, featureId]);
return value;
};
export default useFeature;
//# sourceMappingURL=useFeature.js.map