I want to click button then show modal event
but this code is not showing modal and no reaction
So I tryed add code {()=>BtnModal()} arrowfunction but same not reaction.
And I search other solution this keyworld add, but functional component is not used this keyworld.
How can I solve the problem?
Modal.js (I used antd design)
import { Modal } from 'antd';
function BtnModal(){
const [modal2Visible,setModal2Visible]=useState(true);
return (
<>
<Modal
title="Modal"
centered
visible={modal2Visible}
onOk={() => setModal2Visible(false)}
onCancel={() => setModal2Visible(false)}
>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Sed dolorem ratione qui iste.<br />
Dignissimos nisi sint rerum numquam obcaecati voluptatem quidem, quasi rem,<br />
veritatis voluptatum omnis excepturi, fugit quia harum?</p>
</Modal>
</>
);
};
export default BtnModal;
Header.js
import BtnModal from './BtnModal';
function Header() {
return (
<>
<div className="Head-wrap">
<span>Header</span>
</div>
<div className="btn-list">
<button onClick={BtnModal}>TestBtn</button>
</div>
</>
);
};
export default Header;
I am trying to solve this problem.TT I am trying to solve this problem.....