import React, { useEffect, useState } from 'react'; import type { DrawerProps } from 'antd'; import { Button, Drawer } from 'antd'; const App: React.FC = () => { const [open, setOpen] = useState(false); const [loading, setLoading] = useState(true); let id: NodeJS.Timer; const showDrawer = () => { setOpen(true); }; const onClose = () => { setOpen(false); clearTimeout(Number(id)); }; useEffect(() => { setLoading(true); }, []); useEffect(() => { if (open) { id = setTimeout(() => { setLoading(false); }, 1000); } }, [open]); return ( <> !visible && setLoading(true)} >

Some contents...

Some contents...

Some contents...

); }; export default App;