UNPKG

@devcycle/nextjs-sdk

Version:

The Next.js SDK for DevCycle!

15 lines 564 B
import { jsx as _jsx } from "react/jsx-runtime"; import dynamic from 'next/dynamic'; import useVariableValue from './useVariableValue'; // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const renderIfEnabled = (key, importFunc) => { const Component = dynamic(() => importFunc()); return function (props) { const isEnabled = useVariableValue(key, false); if (isEnabled) { return _jsx(Component, { ...props }); } return null; }; }; //# sourceMappingURL=renderIfEnabled.js.map