DEV Community

Discussion on: Fetch() is All you Need

Collapse
ecyrbe profile image
ecyrbe

I have to desagree on some points because axios is a much more powerfull request layer.

  • First, there are no fetch interceptors, you'll have to use another library for that.
  • Second, fetch does not exist on node, you'll have to use node-fetch emulating library.
  • Third, node-fetch has no proxy handling on node
  • Fourth, fetch error handling is a pain, you'll have to do extra work to extract it and handle edge cases.
  • Fifth, timeout handling and cancellation handling is so much more verbose with fetch.

All these points explain why so many of us prefer using a higher layer library like axios.

Collapse
1e4_ profile image
Ian

Yeh agreed. Fetch isn't a replacement at all for axios, axios simply provides so much more than just fetching something. +1 for interceptors I was going to mention but you beat me too it :)

Collapse
mtee profile image
Margaret W.N

Cave painting😂😂. Woow!

Collapse
etienneburdet profile image
Etienne Burdet

Yep, there is a reason why SSR frameworks still favor Nuxt. It's hell with fetch, there's is always calls responding weirdly.

Collapse
ruheni profile image
Ruheni Alex Author

How does isormophic-unfetch perform in SSR using Nuxt?

Thread Thread
etienneburdet profile image
Etienne Burdet

That's a good question! Never tried it, but seems very attractive. Very minimalist.
Zapper has a nice approach: replacing fetch or this.fetch as needed (being a compiler it's easy enough to do). Effectively, you're just writing you're only using fetch.

Collapse
ruheni profile image
Ruheni Alex Author

Hi! I totally agree with you.

I've noticed the tone I used was a little condescending. Sorry about that. I've made an update clarifying the intention of writing the article and some of the shortcomings of fetch. 🙂

Didn't mean to rattle you😅

Collapse
ecyrbe profile image
ecyrbe

Hello Alex,
No worries. I was not bothered at all by the tone of your post.
You have written a good article, with a lot of insights for developpers.
Keep it up.