How to test useParam() function with Jest

Viewed 1803

Getting this error while testing a component having a hook useParam()

1 Answers
I fixed it using below code.
  jest.mock('react-router-dom', () => ({
    ...jest.requireActual('react-router-dom'),
    useParams: () => ({
      connectionId: '12',
    }),
  }));
Related