title: Reuse React.useCallback() function across multiple components
body: <p>I have a few components that all call the same function on an <code>onPress</code> handler, let's say it looks like the following:</p>
  
  <pre><code>function MyComponent () {
    const dispatch = useDispatch()
  
    const updateThing = React.useCallback((thingId: string) =&gt; {
      dispatch(someActionCreator(thingId))
      someGlobalFunction(thingId)
    }, [dispatch])
  
    return (
      &lt;View&gt;
        &lt;NestedComponent onUpdate={updateThing} /&gt;
      &lt;/View&gt;
    )
  }
  </code></pre>
  
  <p>I want to move this function outside of the component so I can re-use it, thinking it would look something like this:</p>
  
  <pre><code>const updateThing = React.useCallback(myFunction)
  </code></pre>
  
  <p>However, it has a dependency of <code>dispatch</code> that I need to pass in and add to the dependency array.</p>
  
  <p>How can I break this function out for reuse while also getting the performance gain from <code>useCallback</code>?</p>