mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 12:28:33 +08:00
24 lines
502 B
TypeScript
24 lines
502 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: 'success',
|
||
|
content: 'This is a prompt message for success, and it will disappear in 10 seconds',
|
||
|
duration: 10,
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
{contextHolder}
|
||
|
<Button onClick={success}>Customized display duration</Button>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|