Reputation: 195
Getting this error while testing a component having a hook useParam()
Upvotes: 5
Views: 5578
Reputation: 195
I fixed it using below code.
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useParams: () => ({
connectionId: '12',
}),
}));
Upvotes: 11