Skip to main content
Version: 2.x

API Reference > @next-core/brick-kit > DisplayByFeatureFlags

DisplayByFeatureFlags() function

特性开关 React 组件

Signature:

export declare function DisplayByFeatureFlags(
props: React.PropsWithChildren<featureFlagsProps>
): React.ReactElement;

Parameters

ParameterTypeDescription
propsReact.PropsWithChildren<featureFlagsProps>

Returns:

React.ReactElement

Example

featureFlags = {"enabled-foo": true}

<DisplayByFeatureFlags name={["enable-foo"]}>
<div>Can you see me?</div>
</DisplayByFeatureFlags>
// 显示 `Can you see me?`


featureFlags = {"enabled-foo": true}
<DisplayByFeatureFlags fallback={<h1>Good to see you.</h1>} name={"enable-bar"}>
<div>Can you see me?</div>
</DisplayByFeatureFlags>
// 显示 `Good to see you.`