mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-24 15:46:10 +08:00
23 lines
528 B
TypeScript
23 lines
528 B
TypeScript
import React, { useState } from 'react';
|
|
import { Alert, Switch } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [visible, setVisible] = useState(true);
|
|
|
|
const handleClose = () => {
|
|
setVisible(false);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
{visible && (
|
|
<Alert message="Alert Message Text" type="success" closable afterClose={handleClose} />
|
|
)}
|
|
<p>click the close button to see the effect</p>
|
|
<Switch onChange={setVisible} checked={visible} disabled={visible} />
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|