import React, { useState, useLayoutEffect, useRef } from 'react'; import { Select, Button, Modal, Toast, ConfigProvider, Notification } from '@douyinfe/semi-ui'; import en_GB from '@douyinfe/semi-ui/locale/source/en_GB'; import { createPortal } from "react-dom"; const Option = Select.Option; let ind = 0; const ReachableContext = React.createContext(); const useCreatePortalInBody = () => { const wrapperRef = useRef(null); if (wrapperRef.current === null && typeof document !== 'undefined') { const div = document.createElement('div'); div.setAttribute('data-body-portal', ''); wrapperRef.current = div; } useLayoutEffect(() => { const wrapper = wrapperRef.current; if (!wrapper || typeof document === 'undefined') { return; } document.querySelector('.test').appendChild(wrapper); return () => { document.querySelector('.test').appendChild(wrapper); } }, []) return (children => wrapperRef.current && createPortal(children, wrapperRef.current)); } const DialogComponent = props => { const [visible, setVisible] = useState(false); const handleOk = e => { setVisible(false); }; const handleCancel = e => { setVisible(false); }; return ( ); }; const UseModalDemo = () => { const [modal, contextHolder] = Modal.useModal(); const config = { 'title': 'This is a success message', 'content': `${ind}` } return ( document.getElementById("modal-container")} locale={en_GB} >