title: How to make useEffect in custom hook trigger only when props changed?
body: <p>In this video, Dan extract a useDocumentTitle custom hook, but I found the custom hook trigger multiple times, sometimes it is unnecessary. The question is how to trigger the useEffect function only when the key props changed?</p>
  <p>It could be realized like this without using custom hooks:</p>
  <pre><code>useEffect(() =&gt; {
    console.log('useDocumentTitle ')
  
    document.title = myTitle);
  }, [someProp])
  </code></pre>
  <p>But how to do it with custom hooks?</p>
  <p><a href="https://youtu.be/dpw9EHDh2bM?t=2969" rel="nofollow noreferrer">https://youtu.be/dpw9EHDh2bM?t=2969</a></p>