Did you know that you can abort an API request in JavaScript? By aborting, I mean canceling a request before it is completed (before you get a response or before the request gets to the server). By Dillion Megida.
There are many reasons why you may want to do this. One of them is to prevent a request from being sent to the server if the user has already navigated away from the page the request was made.
The article the focuses on:
- The AbortController interface
- Aborting API requests in fetch
- Aborting API requests in axios
Even for new methods of making API requests, by accepting a signal property in their request options object, you can abort requests using the abort() method. Good read!
[Read More]