upvote
Missing a lot of event hooks that axios/ky give you.
reply
Simple examples are interceptors and error handling.

Fetch is one of those things I keep trying to use, but then sorely regret doing so because it's a bit rubbish.

You're probably reinventing axios functionality, badly, in your code.

It's especially useful when you want consistent behaviour across a large codebase, say you want to detect 401s from your API and redirect to a login page. But you don't want to write that on every page.

Now you can do monkey patching shenanigans, or make your own version of fetch like myCompanyFetch and enforce everyone uses it in your linter, or some other rubbish solution.

Or you can just use axios and an interceptor. Clean, elegant.

And every project gets to a size where you need that functionality, or it was a toy and who cares what you use.

reply
Forcing everyone to use ourFetch is rubbish, but forcing everyone to use axios is clean and elegant? You might want to elaborate just a little more.
reply
ourFetch is more likely to be buggy, unmaintained, undocumented and nobody knows it well because the guy who wrote it left the org 2 years ago and so you have to waste time reading and maintaining it yourself.

Axios is something where you get most of that work done for you by the community for free, and a lot of people know it. As long as you don’t get pwned due to it. Oh and you will actually find community packages that integrate with it, vs ourFetch, which again, nobody knows or even cares that it exists.

Applies to web frameworks, databases and other types of software and dependencies - if you work with brilliant people, you might succeed rolling your own, but for most people taking something battle tested, something off the shelf is a pretty sane way to go about it.

In this case it’s a relatively small dependency so it’s not the end of the world, but it’s the exact same principle.

reply
> In this case it’s a relatively small dependency so it’s not the end of the world, but it’s the exact same principle.

An alternative world-view is: "A little copying is better than a little dependency," from https://go-proverbs.github.io

Does become subjective about what "small" and "little" are though.

reply
I also agree with this!

I think the ideal model would be being able to depend on upstream code, but being able to review ALL of the actual code changes when pulling in new dependency versions (with a nice UI) and being able to vendor things and branch off with a single command whenever you need it, so you don't have to maintain it yourself by default but it's trivial when you want to.

It's actually surprising that in regards to front end development the whole shadcn approach hasn't gotten more popular. Or anywhere else for that matter, focusing on making code way more easy to maintain, to compile/deploy, with less complexity along the way.

reply
Exactly, I completely agree.

It's the difference between using a SQL library and some person on your team writing their own SQL library and everyone having to use it. There's a vast gulf between the two, professionally speaking.

People dissing axios probably suffer from other NIH problems too.

reply