标签: reactjs jestjs react-hooks
在测试具有钩子的组件useParam()时得到此错误
答案 0 :(得分:0)
I fixed it using below code. jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), useParams: () => ({ connectionId: '12', }), }));