How to test components using new react router hooks?
Edit: The proper way of doing this the way described in Catalina Astengo’s answer as it uses the real router functionality with just the history/routing state mocked rather than mocking the entire hook. The way I ended up solving it was by mocking the hooks in my tests using jest.mock: // TeamPage.test.js jest.mock(‘react-router-dom’, () => … Read more