mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-01 23:29:30 +08:00
630 B
630 B
order | title | ||||
---|---|---|---|---|---|
7 |
|
zh-CN
平滑、自然的卸载提示。
en-US
Smoothly unmount Alert upon close.
import React, { useState } from 'react';
import { Alert } from 'antd';
const App: React.FC = () => {
const [visible, setVisible] = useState(true);
const handleClose = () => {
setVisible(false);
};
return (
<div>
{visible ? (
<Alert message="Alert Message Text" type="success" closable afterClose={handleClose} />
) : null}
<p>placeholder text here</p>
</div>
);
};
ReactDOM.render(<App />, mountNode);