title: hide modal on when disconnected from internet
body: <p>I have a helper function  connected(), this function is testing whether a user is online or not. It returns false if offline. I have this ant design modal and I am trying to call this function in the visible prop, in order to hide the modal if the user is not connected. I am not sure I am doing this right. Is it also necessary to put to have  a useEffect ? Any idea on how to achieve this result</p>
  <pre><code>export const connected = async () =&gt; {
      try {
          const online = await fetch('/connection');
          return online.status &gt;= 200 &amp;&amp; online.status &lt; 300
      } catch (err) {
          return false 
      }
  }
  
  
      &lt;Modal
       title={test}
       centered
       visible={connected() ? isVisible : false}
       closable={true}
       onCancel={closeModal}
       width={400}
      &gt;
      &lt;p&gt;test&lt;/p&gt;
      &lt;/Modal&gt;
  
  </code></pre>