I am trying to conditionally toggle the inline styling.Even though I am able to change the state on click ,I am unable to change the css styling from display:block to display:none.How can I resolve this issue
define(["vendor/react", "./Button"], function (React, Button) {
const PopUp = (props) => {
const { useState, useEffect } = React;
const { children, confirm } = props;
const [close, setClose] = useState(false);
// Use useEffect to add an event listener to the document
const handleClose = (event) => {
setClose(false);
};
return (
<div
style={{
background: "rgba(0, 0, 0, .65)",
display: close ? "none" : "block",
bottom: 0,
left: 0,
overflow: "auto",
position: "fixed",
right: 0,
top: 0,
zIndex: 1,
}}
>
<div>
{children}
<div>
<div>
<Button onClick={handleClose} icon="close" text="Cancel"></Button>
</div>
<div>
<Button onClick={confirm} icon="send" text="Send"></Button>
</div>
</div>
</div>
</div>
);
};
PopUp.defaultProps = {
button1: "Send",
button2: "Cancel",
};
return PopUp;
});