@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
21 lines • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const FeatureFlagsContext_1 = require("./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 = (0, FeatureFlagsContext_1.useFeatureFlags)();
const value = (0, react_1.useMemo)(() => featureFlags.getFeature(featureId), [featureFlags, featureId]);
return value;
};
exports.default = useFeature;
//# sourceMappingURL=useFeature.js.map