A
A
Alexander2021-01-17 18:35:36
React
Alexander, 2021-01-17 18:35:36

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 question

Ask a Question

731 491 924 answers to any question