import React from 'react'; import { useLoadableFeature } from '../hooks'; export type ChildrenFunction = (isOn: boolean) => React.ReactNode; export interface FeatureProps { featureKey: number; children: ChildrenFunction; } function Feature(props: FeatureProps) { const loadableResult = useLoadableFeature(props.featureKey); if (!loadableResult.loaded) { return null; } const isOn = loadableResult.result; return <>{props.children(isOn)}; } export const HackleFeature = Feature;