UNPKG

@ttoss/react-feature-flags

Version:

React Feature Flags

39 lines (37 loc) 1.35 kB
import * as React from "react"; //#region src/FeatureFlag.d.ts interface FeatureFlagProps { name: FeatureFlags; children: React.ReactNode; fallback?: React.ReactNode; errorFallback?: React.ReactNode; } declare const FeatureFlag: ({ name, children, fallback, errorFallback }: FeatureFlagProps) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null; //#endregion //#region src/FeatureFlagsProvider.d.ts declare const FeatureFlagsProvider: ({ children, loadFeatures }: { children: React.ReactNode; loadFeatures?: () => Promise<FeatureFlags[]>; }) => import("react/jsx-runtime").JSX.Element; //#endregion //#region src/useFeatureFlag.d.ts declare const useFeatureFlag: (name: FeatureFlags) => boolean; //#endregion //#region src/useUpdateFeatures.d.ts /** * If you want to update the feature flags on React environment * (after the initial render and providers), you can use this hook. */ declare const useUpdateFeatures: () => { updateFeatures: (features: FeatureFlags[]) => void; }; //#endregion export { FeatureFlag, FeatureFlagsProvider, useFeatureFlag, useUpdateFeatures };