mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 06:58:33 +08:00
27 lines
582 B
TypeScript
27 lines
582 B
TypeScript
|
import React from 'react';
|
||
|
import { Button, message } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [messageApi, contextHolder] = message.useMessage();
|
||
|
|
||
|
const success = () => {
|
||
|
messageApi
|
||
|
.open({
|
||
|
type: 'loading',
|
||
|
content: 'Action in progress..',
|
||
|
duration: 2.5,
|
||
|
})
|
||
|
.then(() => message.success('Loading finished', 2.5))
|
||
|
.then(() => message.info('Loading finished', 2.5));
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
{contextHolder}
|
||
|
<Button onClick={success}>Display sequential messages</Button>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|