jargon

Comparison

AbortControllervsfetch

AbortController

the component unmounted mid-request, so you cancelled the fetch instead of letting it resolve into nothing.

A cancellation token accepted by `fetch`, `addEventListener` and a growing set of platform APIs. Passing one signal to every listener a component registers means teardown is a single `abort()` call rather than a list of matching `removeEventListener` calls. For requests it also prevents an out-of-order response from overwriting fresher data, which is the more valuable half.

Full entry →

fetch

the request returned a 500 and your `.catch` never ran, because the promise resolved just fine.

The browser's promise-based HTTP API, which rejects only on network failure and never on an HTTP error status. Every wrapper written around it exists mostly to fix that one behaviour, along with JSON parsing and timeouts, which it also does not provide. It does give you streams, an abort signal and per-request cache and credential modes, which XHR never had.

Full entry →

Related comparisons