title: How to memoize custom React hook
body: <pre><code>const useSomeHook = ({number}) =&gt; {
    const [newNumber, setNewNumber] = useState(0)
  
    useEffect(() =&gt; {
      setNewNumber(number + 1)
    }, [number])
  }
  
  const SomeComponent = ({number, value, ...restProps}) =&gt; {
  
    useSomeHook({number})
  
  
    return &lt;div&gt;{number}&lt;/div&gt;
  }
  </code></pre>
  
  <p>Let's imagine I have this case. Each time when in <code>SomeComponent</code> come some new prop, it will call my <code>useSomeHook</code> hook, but I want to prevent it. I want to call it only when the <code>number</code> is changed (<code>memoize</code> it). In other cases, don't touch it. But I haven't found any solving with this case. Could you help me solve this issue?</p>