Cancel tokens seem to work really well for complex scenarios, but for really simple use cases, the API is awkward for the user. It takes too many lines of code to do the simple thing.
let cancel;
let token = new CancelToken(c => cancel = c);
fetch("some-data.json", token).then(response => {
// ...
});
cancel();
Cancel tokens seem to work really well for complex scenarios, but for really simple use cases, the API is awkward for the user. It takes too many lines of code to do the simple thing.