addons/isl/src/components/GatedComponent.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {useFeatureFlagSync} from '../featureFlags';
b69ab319
b69ab3110export default function GatedComponent({
b69ab3111 featureFlag,
b69ab3112 children,
b69ab3113}: {
b69ab3114 children: React.ReactNode;
b69ab3115 featureFlag: string | undefined;
b69ab3116}) {
b69ab3117 const featureEnabled = useFeatureFlagSync(featureFlag);
b69ab3118
b69ab3119 if (!featureEnabled) {
b69ab3120 return null;
b69ab3121 }
b69ab3122 return children;
b69ab3123}