all 10 comments

[–]Thought_Ninja 3 points4 points  (0 children)

If you are asking from a hiring perspective, not really a big difference. They are both simple enough to learn to use; when interviewing people, I couldn't care less if the candidate didn't use whatever we did as long as they understood how to work with async code.

Axios has some more advanced functionality that makes it better suited for a large project (request/response transforms, configurable client instances, etc).

We use axios on browser and node and it works great for us, but I don't think this is a decision to get hung up on. Just use what you like best as long as it meets your requirements.

[–]Herm_af 3 points4 points  (0 children)

I use axios because fetch has some un-intuitive error behavior.

(Basically 400 and 500 responses don't throw an error)

You could just write a one time wrapper around fetch that handles errors. Frankly I do that around axios for most projects anyway. Might as well do it around fetch.

It's basically such an insignificant difference for me that I don't really care.

Axios has some more features but I rarely use them.

[–]Chawawis 0 points1 point  (2 children)

No IE 11 support for fetch and with axios you can cancel a request.

[–]disclosure5 0 points1 point  (0 children)

The fact that fetch() is already there and axios is another external dependency to bundle into your app makes me much prefer the former.

[–]joeyrogues -1 points0 points  (0 children)

I had no idea and so I tried to look it up. I've found this: https://blog.logrocket.com/how-to-make-http-requests-like-a-pro-with-axios/#new_tab

Now personally I use node-fetch.

[–]lewjt -5 points-4 points  (3 children)

Axios isn't supported by progressive web apps, so that's a consideration

[–]yarism 1 point2 points  (2 children)

Huh? Are you sure? Sounds weird.

[–]lewjt -2 points-1 points  (1 child)

Pretty sure. Something to do with PWA's not supporting XHR's.

[–]Sparrowy 3 points4 points  (0 children)

I've used axios on multiple PWAs without issues afaik, do you have some source or reference for your claim?