Fetch or Axios — which to select for HTTP requests?
This article was originally published at https://www.blog.duomly.com/fetch-vs-axios-what-is-better-in-2020/
Intro to Fetch vs. Axios
One of the most essential parts of frontend development is communication with the backend by making HTTP requests. There are a few ways how we can make API calls in Javascript asynchronously.
A few years ago, most applications were sending HTTP requests using Ajax, which stands for Asynchronous Javascript and XML. But right now, developers mostly decide about selection between fetch() API and Axios.
In this article, I’d like to compare those two methods, go through basic overview and syntax. Besides that, I’ll compare the process of converting data to JSON format in both cases and error handling as well. I’m also going to talk about HTTP interception and download progress.
Let’s start!