import React, { useState } from 'react'; import { Button, Drawer } from 'antd'; export default props => { const { children, width, destroyOnClose } = props; const [visible, setVisible] = useState(false); const handleDrawerClose = () => setVisible(false); const handleDrawerShow = () => setVisible(true); return ( {React.cloneElement(children, { onOk: handleDrawerClose, onCancel: handleDrawerClose, })} ); };