Live Online Classes in Design, Coding & AI — Small Classes, Free Retakes
Start speaking a new language. It’s just 3 weeks away.
Overview
Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This tutorial shows how to build two reusable custom React hooks with Axios for async/await requests. It demonstrates data fetching, refetching, POST requests, multiple Axios instances, request cancellation, and testing the hooks in example components.
Syllabus
Intro
Welcome
Install Axios
useAxios hook
Request Config
useAxios continued
AbortController - not isMounted
useAxios completed
Create an Axios instance
Joke component
Testing useAxios
Add refetch to useAxios
Testing refetch
useAxios vs useAxiosFunction
useAxiosFunction
Create a 2nd Axios instance
Posts component
Quick debug
Testing useAxiosFunction
Taught by
Dave Gray