Complete Axios in 15minutes

Thapa Axios

What we will cover in this video

  1. What is Axios?
  2. Advantage of using Axios?
  3. Use Axios in React with Promises
  4. Error handling with Axios
  5. Axios with Async Await
  6. Best Way to write Axios

What is Axios?

Axios is lightweight package and use to make HTTP requests in Any Javascript Library like React, Angular or Vue. Axios makes it easy to send asynchronous HTTP requests to REST endpoints and perform CRUD operations. If you use Fetch method in Javascript, Axios is the “Easy to use” Version of Fetch.


Advantages of using Axios

Axios by default Work in JSON format.So no more JSON parsing.

Make all types of HTTP requests (GET, POST, PUT, DELETE)


How to install Axios in React App

Like any other npm package, you have to simply install Axios package in your React Application and import axios from the axios package.


Install Axios


Use Axios in React with Promises and Error Handling


Use Axios in React with Async & Await. Also Error Handling woth Try Catch


Best wat to write Axios in react app by creating a axios.js file and add the below code and then simply import the axios from this file and pass only the string for which you want data.



Note:

If you want more videos then please like share and don't forget to subscribe my channel & you can suggest me the topics on which you want me to make video in comment section i will definitely work on it.

Subscribe - Thapa Technical