import React, { FC, PropsWithChildren, useContext } from 'react'; import { createPortal } from 'react-dom'; import { AppRootContext } from './AppRootContext'; export const AppRootPortal: FC> = ({ children, className }) => { const { portalRoot, embedded } = useContext(AppRootContext); return embedded && portalRoot ? createPortal((
{children}
), portalRoot) : <>{children}; };