title: Stop useEffect from running on mount
body: <p>I only want useEffect to run when my dependency list changes, it is also running every time the component is mounted, is there any way to not fire on mount?</p>
  
  <blockquote>
    <p>You can tell React to skip applying an effect if certain values
    haven’t changed between re-renders.</p>
  </blockquote>
  
  <p>I initially thought that meant it shouldn't re-render on subsequent mounts but <a href="https://stackoverflow.com/a/56195643/210757">this question cleared that up.</a></p>
  
  <p>I am displaying a list of records in a master "page" (react-router), the user can choose a single record and go to the detail page, and then return to the master page - so the master list component is completely unmounted/mounted in that scenario.  And every time I load the "master page", I see the data being fetched, I only want this to happen when one of the dependencies changes; these dependencies and the data itself are stored in Redux so they're global.</p>
  
  <p>Can useEffect or another hook be made to only fire when the dependencies change?</p>
  
  <pre><code>const {page, pageSize, search, sorts} = useSelector(getFilters);
  const data = useSelector(getData);
  
  useEffect(() =&gt; {
  
    console.log("fetching");
    dispatch(fetchData(page, pageSize, search, sorts));
  
  }, [page, pageSize, search, sorts]);
  </code></pre>