import React, { FC, useRef, useEffect, Suspense } from 'react'; import { Root, createRoot } from 'react-dom/client'; import { IPreviewerProps } from 'dumi'; import DefaultPreviewer from 'dumi/theme-default/builtins/Previewer'; const Previewer: FC = ({ children, ...props }) => { const ref = useRef(null); useEffect(() => { let root: Root if (ref.current) { root = createRoot(ref.current) root.render(loading...}>{children}) } return () => { if (root) { root.unmount() } } }, []); return
; }; export default Previewer;