From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Axios installation and example

Axios installation and example

Hello, and welcome back. Let's discuss the Exeos library now. Exeos is a third-party library, and it's used for simplifying and making HTTP requests. Let's have the pros and cons for Exeos. We'll go about the pros first. It provides automatic JSON handling, which was missing in the Fetch API. The request and response interceptors are available in Axios. We can have request timeouts and request cancellations, as well as we have the base URL support. So we don't have to put the never-changing base URL everywhere in the code. We can have the necessary headers which are required for all the requests inside one single file. The cons are a little less as compared to the Fetch API and that's why Xeos is most widely used libraries and very popular in the developers. So one con, which I think is not actually a con, is requires installation. So you need a package to be explicitly installed in your application for Exeuse to work. It can make the bundle size of your application slightly larger…

Contents