import React from "react"; import styles from "./index.less"; import { Popconfirm, Switch, message } from "antd"; class App extends React.Component { state = { visible: false, condition: true // Whether meet the condition, if not show popconfirm. }; changeCondition = value => { this.setState({ condition: value }); }; confirm = () => { this.setState({ visible: false }); message.success("Next step."); }; cancel = () => { this.setState({ visible: false }); message.error("Click on cancel."); }; handleVisibleChange = visible => { if (!visible) { this.setState({ visible }); return; } // Determining condition before show the popconfirm. console.log(this.state.condition); if (this.state.condition) { this.confirm(); // next step } else { this.setState({ visible }); // show the popconfirm } }; render() { return (
Delete a task

Whether directly execute:
); } } export default () => (
);