title: Re-execute React Effect on URL change for Chrome Extension
body: <p>I am using React in a Chrome Extension where the extension's <code>content.js</code> loads the <code>index.html</code> of the compiled React app.</p>
  <p>In the React app, an effect prints out the current tab's domain in the JS console when the app first loads, due to having a dependency of <code>[]</code>.</p>
  <pre class="lang-js prettyprint-override"><code>function App() {
      useEffect(() =&gt; {
          chrome.tabs.query({ active: true, currentWindow: true }, (tabs) =&gt; {
              const url = new URL(tabs[0].url);
              const domain = url.hostname;
              console.log(&quot;Domain:&quot;, domain);
          });
      }, []);
  
      ...
  }
  </code></pre>
  <p>Is it possible to modify this such that the effect is executed again everytime the tab is navigated to another URL?</p>