UNPKG

@magicbell/magicbell-react

Version:

React components for building a notification inbox for your app

17 lines 773 B
import React, { useContext } from 'react'; import CurrentProviderContext, { NO_PROVIDER } from '../../context/CurrentProviderContext.js'; import MagicBellProvider from './MagicBellProvider.js'; /** * Component that conditionally wraps the children with a MagicBellProvider * unless one is defined already. */ export default function MagicBellChildrenWrapper({ children, apiKey, ...settings }) { const currentContext = useContext(CurrentProviderContext); if (currentContext === NO_PROVIDER) { if (!apiKey) return null; return (React.createElement(MagicBellProvider, { apiKey: apiKey, ...settings }, children)); } return React.createElement(React.Fragment, null, children); } //# sourceMappingURL=MagicBellChildrenWrapper.js.map