Sunday 30 January 2022

Chapter4-Axios Library

 Introduction to Axios: Axios, which is a popular library is mainly used to send asynchronous HTTP requests to REST endpoints. This library is very useful to perform CRUD operations.

  • This popular library is used to communicate with the backend.
  •  Axios supports the Promise API, native to JS ES6.
  • Using Axios we make API requests in our application. Once the request is made we get the data in Return, and then we use this data in our project. 

Install Axios library using the command given below…

npm install axios

After Axios installation, you can import this library into your file and use it to make an HTTP request. 

Axios.get("https://jsonplaceholder.typicode.com/users").then(result => {
            console.log(result.data);
        },

Axios provides different methods for CRUD operation like 
get() ---- to fetch data
post()---- to submit data
put() ---- to update data
delete() --- to delete data



PostedBy: pankaj_bhakre  

No comments:

Post a Comment