import React, { useMemo } from 'react'; import { Button, Divider, InputNumber, notification, Space, Switch } from 'antd'; const Context = React.createContext({ name: 'Default' }); const App: React.FC = () => { const [enabled, setEnabled] = React.useState(true); const [threshold, setThreshold] = React.useState(3); const [api, contextHolder] = notification.useNotification({ stack: enabled ? { threshold, } : false, }); const openNotification = () => { api.open({ message: 'Notification Title', description: `${Array(Math.round(Math.random() * 5) + 1) .fill('This is the content of the notification.') .join('\n')}`, duration: null, }); }; const contextValue = useMemo(() => ({ name: 'Ant Design' }), []); return ( {contextHolder}
Enabled: setEnabled(v)} /> Threshold: setThreshold(v || 0)} />
); }; export default App;