title: "beforeinstallprompt" prompt() causes infinite useEffect loop
body: <p><em>e.prompt()</em> derived from <code>beforeinstallprompt</code> causes in infinite <em>useEffect</em> loop.</p>
  <p>On <code>beforeinstallprompt</code>, <em>handle_storePrompt()</em> sets <em>showButton</em> to true (<code>&lt;button /&gt;</code> &quot;display:block&quot;). OnClick, <em>handle_prompt()</em> sets <em>showButton</em> to false (<code>&lt;button /&gt;</code> &quot;display:none&quot;). After <em>prompt()</em> is resolved, <code>beforeinstallprompt</code> is against fired causing <em>handle_storePrompt()</em> to run again.</p>
  <p><strong>Component</strong></p>
  <pre><code>const [showButton, setShowButton] = useState(false)
  const [prompt, setPrompt] = useState()
  
  useEffect(() =&gt; {
      const handle_storePrompt = e =&gt; {
          e.preventDefault()
          console.log('Action Triggered')
          setPrompt(e)
          setShowButton(true)
      }
  
      window.addEventListener('beforeinstallprompt', e =&gt;
          handle_storePrompt(e)
      )
  
      return _ =&gt; {
          window.removeEventListener('beforeinstallprompt', e =&gt;
              handle_storePrompt(e)
          )
      }
  }, [])
  
  const handle_prompt = _ =&gt; {
      setShowButton(false)
      prompt.prompt()
  }
  
  return (
      &lt;button className={showButton ? Styles.show : ''} onClick={handle_prompt}&gt;
          &lt;small&gt;Click to Install&lt;/small&gt;
      &lt;/button&gt;
  )
  </code></pre>