Answer the question
In order to leave comments, you need to log in
How to add modal window closing based on background in React?
What is the condition for this task?
const [modalCheckout, setModalCheckout] = useState(false)
const onClickOrder = () => {
setModalCheckout(true)
}
const onCloseModal = () => {
setModalCheckout(false)
}
{modalCheckout && (
<ModalPopup onClick={onCloseModal}>
<h1>ModalPopup</h1>
<button>Send</button>
</ModalPopup>
)}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question