import React from 'react'; import { Button, notification, Space } from 'antd'; const close = () => { console.log( 'Notification was closed. Either the close button was clicked or duration time elapsed.', ); }; const App: React.FC = () => { const [api, contextHolder] = notification.useNotification(); const openNotification = () => { const key = `open${Date.now()}`; const btn = ( ); api.open({ message: 'Notification Title', description: 'A function will be be called after the notification is closed (automatically after the "duration" time of manually).', btn, key, onClose: close, }); }; return ( <> {contextHolder} ); }; export default App;