What we will cover in this video
- What is Axios?
- Advantage of using Axios?
- Use Axios in React with Promises
- Error handling with Axios
- Axios with Async Await
- 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.