Skip to content

Syammed2429/useFetch-custom-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run npm i cloned directory and npm run dev to serve the site.

It's a custom hook of useFetch

If you're fetching the data on different components and using axios / fetch again and again then , this code gonna help you. 😀

I made a simple custom react hook to fetch the data .

import the useFetch in your component's and pass an url to it :

and useFetch returns you three values , loading, data, error

Example const {loading, data, error} = useFetch("https://api.com/users)

Use it as per you need

Demo and Live link

useFeth Custom Hook

If you like it please start it and contribute to my projects 😀