import React from 'react'; import type { DrawerProps } from 'antd'; import { Button, Drawer } from 'antd'; const App: React.FC = () => { const [open, setOpen] = React.useState(false); const [loading, setLoading] = React.useState(true); const timerRef = React.useRef>(); const clearTimer = () => { if (timerRef.current) { clearTimeout(timerRef.current); } }; const showDrawer = () => { setOpen(true); setLoading(true); timerRef.current = setTimeout(() => { setLoading(false); }, 2000); }; React.useEffect(() => clearTimer, []); return ( <> setOpen(false)} >

Some contents...

Some contents...

Some contents...

); }; export default App;