ant-design/components/message/demo/hooks.tsx
hms181231 52d2b41f9d
chore: Update message hooks demo (#38707)
* chore: update message hooks demo

* chore: update message hooks demo
2022-11-18 23:36:29 +08:00

22 lines
400 B
TypeScript

import React from 'react';
import { Button, message } from 'antd';
const App: React.FC = () => {
const [messageApi, contextHolder] = message.useMessage();
const info = () => {
messageApi.info('Hello, Ant Design!');
};
return (
<>
{contextHolder}
<Button type="primary" onClick={info}>
Display normal message
</Button>
</>
);
};
export default App;