title: modal reactjs close time
body: <p>I need my modal to close after a certain time, how can I do this?
  this is what i have done so far</p>
  
  <pre><code>import React from 'react';
  import IconcloseModal from './../../assets/icon/icon-cerrar-modal.png';
  import './Modal.css'
  
  const Modal = ({ typeModal, textModal, showModal, positionModal, closeModal }) =&gt; {
      let titleModal = '';
      if (typeModal === 'success')
          titleModal = '¡Bien hecho!';
      else if (typeModal === 'warning')
          titleModal = '¡Cuidado!';
      return (
          &lt;div&gt;
              &lt;div className={(showModal) ? 'notify ' + positionModal + ' do-show' : 'notify ' + positionModal}
                  data-notification-status={typeModal}&gt;
                  &lt;div className="content-warning"&gt;
                      &lt;h3&gt;{titleModal}&lt;/h3&gt;
                      &lt;p&gt; {textModal}&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;div onClick={closeModal} className="close-alert"&gt;&lt;img src={IconcloseModal} alt="Logo cerrar modal" /&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      )
  }
  export default Modal;
  </code></pre>