UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

22 lines (21 loc) 643 B
// src/context/feature-flags.tsx import { createContext, useContext } from "react"; import { jsx } from "react/jsx-runtime"; var FeatureFlagContext = createContext(null); function FeatureFlags(props) { return /* @__PURE__ */ jsx(FeatureFlagContext.Provider, { value: props.flags, children: props.children }); } function useFeatureFlags(key) { const context = useContext(FeatureFlagContext); if (context === null) { throw new Error( "useFeatureFlag must be used within a FeatureFlags Provider" ); } return context[key] ?? false; } export { FeatureFlags, useFeatureFlags }; //# sourceMappingURL=chunk-CJFW36DZ.js.map