title: Mocking react-router-dom hooks using jest is not working
body: <p>I'm using Enzyme's shallow method to test a component which uses the <code>useParams</code> hook to get an ID from the URL params.</p>
  
  <p>I'm trying to mock the <code>useParams</code> hook so that it does't call the actual method, but it doesn't work. I'm still getting <code>TypeError: Cannot read property 'match' of undefined</code>, so it calls the actual <code>useParams</code>, and not my mock.</p>
  
  <p>My component:</p>
  
  <pre><code>import React from 'react';
  import { useParams } from 'react-router-dom';
  
  export default () =&gt; {
  
    const { id } = useParams();
  
    return &lt;div&gt;{id}&lt;/div&gt;;
  
  };
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>import Enzyme from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  import React from 'react';
  import Header from './header';
  import { shallow } from 'enzyme';
  
  Enzyme.configure({ adapter: new Adapter() });
  
  describe('&lt;Header /&gt;', () =&gt; {
  
    jest.mock('react-router-dom', () =&gt; ({
      useParams: jest.fn().mockReturnValue({ id: '123' }),
    }));
  
    it('renders', () =&gt; {
      const wrapper = shallow(&lt;Header /&gt;);
      expect(wrapper).toBeTruthy();
    });
  
  });
  </code></pre>
  
  <p>Thank you!</p>