Axios is a popular library for making HTTP requests from the browser. It allows us to make GET, POST, PUT, and DELETE requests from the browser. Therefore, React Native uses Axios to make requests to an API, return data from the API, and then perform actions with that data in our React Native app. We can use Axios by adding the Axios plugin to our project using the following command.
# Yarn
$ yarn add axios
# npm
$ npm install axios –save
Axios have several features, which are listed below:
- It makes XMLHttpRequests from the browser.
- It makes Http requests from the React Native framework.
- It supports most of the React Native API.
- It offers a client-side feature that protects the application from XSRF.
- It automatically transforms response and request data with the browser.