Axios has some disadvantages, and the most critical is that it is much slover than fetch API.
Slower, it's because it uses XHR under the hood in the browser. Yeah, it is helpful for cases when you need the older browsers suppor. I would recommend recommend to use at least ky instead of axios, for better performance, though all mentioned features can be ease replicated by pure js.
π¨βπ» Software Developer | Code Beyond ; π
Hey, I'm Ankita, a passionate software developer with a knack for turning lines of code into functional and user-friendly solutions.
Thank you for sharing your thoughts! You're right, Axios can be a bit slower because of XHR, but it's handy for older browser support. I'll definitely give ky a try to see how it compares. Always good to explore new tools!
Axios has some disadvantages, and the most critical is that it is much slover than fetch API.
Slower, it's because it uses XHR under the hood in the browser. Yeah, it is helpful for cases when you need the older browsers suppor. I would recommend recommend to use at least ky instead of axios, for better performance, though all mentioned features can be ease replicated by pure js.
Thank you for sharing your thoughts! You're right, Axios can be a bit slower because of XHR, but it's handy for older browser support. I'll definitely give ky a try to see how it compares. Always good to explore new tools!
Is the performance difference noticeable against any average APIs response time?
IMO given that an average API may take between 100-500ms to respond, axios being slower should not be the optimization devs should be focusing on.
There's other good reasons instead, such as fetch being capable enough and being supported without packages in both browser and nodejs.