DEV Community

Discussion on: Using JavaScript Fetch API to Get and Post Data

stevetaylor profile image
Steve Taylor

The problem with Promises is they don’t support cancellation. There’s AbortController for fetch, but it’s super awkward to use and browser support could be better. Anything beyond a POC that hits endpoints should abort pending requests whose results are no longer required. Observable is a better fit than Promise because it supports cancellation of the underlying resource when unsubscribing.