COMPARISON

Why JavaScript Developers Should Prefer Axios Over Fetch

Backward-compatibility, monitoring upload progress, and more

Sabesan Sathananthan
Better Programming
Published in
6 min readFeb 24, 2021

A dog catching a ball
Photo by Brixiv from Pexels

In my previous article, “Deep Insights Into JavaScript’s Fetch API”, I discussed the basics of the Fetch API. But it’s worth acknowledging that fetch() isn’t consistently an ideal solution, and there are sometimes better alternatives for making HTTP requests. Here I’ll describe why Axios is better than fetch() in development. This is my 36th Medium article.

Overview and Syntax

Fetch

Fetch() is part of a JavaScript window-object method within the Fetch API. It is built in, so users don’t have to install it. Fetch() allows us to get data from the API asynchronously without installing any additional libraries.

The above piece of code is a simple fetch() get request. In the fetch() method, there’s one mandatory argument, which is url. url is a path from which the user would like to get data. Then fetch() method returns a promise…

Written by Sabesan Sathananthan

Software Engineer 👨‍💻 @SyscoLABSSL | Postgard🧑‍🎓 in CSE at UOM | Technical Writer ✍️ | sabesansathananthan.now.sh | Still makes silly mistakes daily.

Responses (11)