When making API calls, it is possible to run into race conditions using useEffect. To fix it, we need to cancel all asynchronous tasks in the cleanup function.