@ttoss/react-feature-flags
Version:
React Feature Flags
27 lines (21 loc) • 1.15 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React from 'react';
interface FeatureFlagProps {
name: FeatureFlags;
children: React.ReactNode;
fallback?: React.ReactNode;
}
declare const FeatureFlag: ({ name, children, fallback, }: 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> | react_jsx_runtime.JSX.Element | null;
declare const FeatureFlagsProvider: ({ children, loadFeatures, }: {
children: React.ReactNode;
loadFeatures?: () => Promise<FeatureFlags[]>;
}) => react_jsx_runtime.JSX.Element;
declare const useFeatureFlag: (name: FeatureFlags) => boolean;
/**
* 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;
};
export { FeatureFlag, FeatureFlagsProvider, useFeatureFlag, useUpdateFeatures };