title: How to write spyOn custom hook
body: <p>I have a custom hook</p>
  <pre><code>import { useDispatch } from 'react-redux';
  import { SET_APP_TITLE } from '../reducers/appBar';
  
  export const useTitle = (title: string) =&gt; {
    const dispatch = useDispatch();
    return dispatch({ type: SET_APP_TITLE, title });
  };
  </code></pre>
  <p>And component using it</p>
  <pre><code>import { useTitle } from '../common/useTitle';
  export default () =&gt; {
    useTitle('Dashboard');
    return &lt;div&gt;Dashboard&lt;/div&gt;
  }
  </code></pre>
  <p>Now I want to write unit test (using Jest and React Testing Library) for the component:</p>
  <pre><code>import React from 'react';
  import { render } from '@testing-library/react';
  import Dashboard from './Dashboard';
  import { useTitle } from '../commons/useTitle';
  
  describe('Dashboard', () =&gt; {
    it('renders without crashing', () =&gt; {
      const { getByText } = render(&lt;Dashboard /&gt;);
      expect(getByText('Dashboard')).toBeInTheDocument();
    });
  });
  </code></pre>
  <p>In this test I'd like to spy on my custom hook and assert that the component tries to set valid title.</p>