Written by Faraz Kelhini✏️
In my recent post “How to make HTTP requests like a pro with Axios,” I discussed the benefits of using the Axios librar...
For further actions, you may consider blocking this person and/or reporting abuse
Hmm.
I believe axios has alias methods (which you even used later in the article), ie.
axios.get()
- github.com/axios/axios#request-met...There’s a nice wrapper for fetch at github.com/elbywan/wretch
Thanks for that :)
Edit: ouch, 7.6KB minified :x
I guess author did a little bit too much for my taste ;)
Well, axios is 12.6KB minified.
Native fetch is 0KB minified. ;)
Yes it's true, but this can apply to any library and frameworks. Vanilla is always lighter except for the amount of boilerplate code it can bring. And fetch can bring a tons of boilerplate.
I'll cut 3KB (gzipped) on the framework any day to have a good base for the service layer.
I guess priorities differ.
Im not willing to import 12KB of abstractions to use one/two methods of it and i didnt find fetch to bring a lot of boilerpate for me.
Axios is my go-to for server-side rendering of applications since it works independently of the window. But there's also isomorphic-fetch, so there's that as well. Haven't had any complaints about either. 🤷♂️
If someone suggests me to use a library for something that can be done just fine without it, then i usually shoo them away, usually whilst wearing a robe.
Then i turn around and continue worshiping our great leader, the minimal payload.
youtube.com/watch?v=xJB2xEeq3MA
For reference, Axios is a 5.5kb library, gzipped.
That is absolutely humongous, relatively speaking.
raw.githubusercontent.com/axios/ax...
What about cancelling requests? Am I right to say that axios makes it easy with its cancel token API but fetch doesn’t have any native way to do it?
Now we're asking the real questions
angular user, just HttpClient ;D
Why mutate global objects when you can write a wrapper around it?