DEV Community

Cover image for Why using AXIOS with Typescript?

Why using AXIOS with Typescript?

limacodes on February 10, 2023

I want to explore on this post about working with API using typescript by comparing fetch to axis BUT focusing on productivity First th...
Collapse
 
grisho4ek profile image
Grygorii Shevchenko • Edited

In my opinion the main advantage of using axios is interceptors. They are very useful for refreshing token and updating an authorization header before sending requests to api endpoints and also they can be used for error handling.

Collapse
 
limacodes profile image
limacodes

Thank you for your input :) You are correct, axios does indeed have a great feature in the form of interceptors. And you're also right about the ease of error handling with interceptors for sure.
Yeah Axios is a powerful tool for handling HTTP requests in the frontend.
Great point