Question 9 of 10Pro Only
How do you test a React component that makes API calls? Show how to mock fetch or axios in your tests.
Sample answer preview
Testing components that make API calls requires mocking those calls to have fast, reliable tests that are independent of the backend. Here is a component that fetches data.
fetchaxiosMSWmockmockResolvedValueasync testing