mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
28 lines
465 B
TypeScript
28 lines
465 B
TypeScript
|
import React from 'react';
|
||
|
import { App, Button } from 'antd';
|
||
|
|
||
|
// Sub page
|
||
|
const MyPage = () => {
|
||
|
const { modal } = App.useApp();
|
||
|
|
||
|
const showModal = () => {
|
||
|
modal.warning({
|
||
|
title: 'This is a warning message',
|
||
|
content: 'some messages...some messages...',
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<Button type="primary" onClick={showModal}>
|
||
|
Open modal
|
||
|
</Button>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
// Entry component
|
||
|
export default () => (
|
||
|
<App>
|
||
|
<MyPage />
|
||
|
</App>
|
||
|
);
|