however I would not use axios in the front end though. fetch is very easy to work with - if you want some of the axios' default behaviors (throw on 4xx/5xx, returns data by default) you can easily wrap fetch in your own helper function to do that.
Because fetch is already pretty good. I'm not against axios - if you know what you are doing. For any new devs I'd highly recommend learning all the basic DOM APIs and utilities instead of trying to find a third party library for everything.
axios
has this thing calledCancelToken
: github.com/axios/axios#cancellationit is very similar to
AbortController
😄however I would not use
axios
in the front end though.fetch
is very easy to work with - if you want some of theaxios
' default behaviors (throw on 4xx/5xx, returns data by default) you can easily wrapfetch
in your own helper function to do that.Why are you not recommending using axios?
Because
fetch
is already pretty good. I'm not againstaxios
- if you know what you are doing. For any new devs I'd highly recommend learning all the basic DOM APIs and utilities instead of trying to find a third party library for everything.Cool, yeah, best tip, learn all basic DOM API, I'm currently doing this one.
Tbh, this is a very underrated tip but very helpful in the long run.