Abort a fetch request manually in JavaScript

1 · Amit Merchant · Sept. 17, 2021, 12:01 p.m.
The Fetch API, as you might know, is a modern replacement of the good old XHRHttpRequest (popularly known as Ajax) that gives nicer developer experience (DX) by giving a promise based implementation. The AbortController interface Aborting the request A real-world example Here’s a simple example of how you would make a GET request to this API: https://jsonplaceholder.typicode.com/posts/1 fetch('https://jsonplaceholder.typicode.com/posts/1') .then(response => { console.log('success!'); }...