title: How can I mock useAxios hook from axios-hooks using Jest? (Error: Uncaught [TypeError: undefined is not a function])
body: <p>I am new to Jest, and I want to mock <code>useAxios</code> from <a href="https://github.com/simoneb/axios-hooks" rel="nofollow noreferrer"><code>axios-hooks</code></a> in order to avoid actually calling a service. This is my copmonent:</p>
  
  <pre class="lang-js prettyprint-override"><code>import React from 'react'
  import useAxios from 'axios-hooks'
  import { Table, Space } from 'antd'
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
  import { faEdit, faCalendar, faUserPlus } from '@fortawesome/free-solid-svg-icons'
  
  const Projects = () =&gt; {
    const [{ data: projects, loading, error }] = useAxios(
      `${process.env.REACT_APP_API_URL}/projects/`
    )
  
    if (loading) return &lt;p&gt;Loading...&lt;/p&gt;
    if (error) return &lt;p&gt;Error!&lt;/p&gt;
  
    const columns = [
      {
        title: 'Title',
        dataIndex: 'title',
        key: 'title',
        render: title =&gt; &lt;a&gt;{title}&lt;/a&gt;
      },
      {
        title: 'Start Date',
        dataIndex: 'startDate',
        key: 'startDate'
      },
      {
        title: 'Description',
        dataIndex: 'description',
        key: 'description',
        render: description =&gt; `${description.substring(0, 50)}...`
      },
      {
        title: 'Team',
        dataIndex: 'team',
        key: 'team'
      },
      {
        title: 'Action',
        key: 'action',
        render: (text, record) =&gt; (
          &lt;Space size='middle'&gt;
            &lt;FontAwesomeIcon icon={faEdit} /&gt;
            &lt;FontAwesomeIcon icon={faCalendar} /&gt;
            &lt;FontAwesomeIcon icon={faUserPlus} /&gt;
          &lt;/Space&gt;
        )
      }
    ]
  
    return (
      &lt;Table
        data-testid='project-table-id'
        columns={columns}
        dataSource={projects}
        pagination={false}
      /&gt;
    )
  }
  
  export default Projects
  </code></pre>
  
  <p>This is the test I am implementing:</p>
  
  <pre class="lang-js prettyprint-override"><code>import React from 'react'
  import { render, cleanup } from '@testing-library/react'
  import Projects from '../Projects'
  import useAxios from 'axios-hooks'
  jest.mock('axios-hooks')
  
  describe('Projects component', () =&gt; {
    afterEach(cleanup)
  
    it('renders project table', async () =&gt; {
      const fakeResponse = [
        {
          title: 'Testing Project Alpha',
          startDate: '2020-04-18',
          description: 'This is just for testing',
          team: 'A, B, C'
        },
        {
          title: 'Testing Project Beta',
          startDate: '2020-04-19',
          description: 'This is just for testing too',
          team: 'X, Y, Z'
        }
      ]
      useAxios.mockImplementation(() =&gt; Promise.resolve({fakeResponse}))
      const { getByTestId } = render(&lt;Projects /&gt;)
      expect(getByTestId('project-table-id')).not.toBeNull()
    })
  })
  
  </code></pre>
  
  <p>However, I am getting the following error:</p>
  
  <pre><code>Error: Uncaught [TypeError: undefined is not a function]
  </code></pre>
  
  <p>How can I solve this issue?</p>