Skip to content

Commit 52c1e60

Browse files
committed
usefetch React custom hook
0 parents  commit 52c1e60

File tree

14 files changed

+1068
-0
lines changed

14 files changed

+1068
-0
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
REACT_APP_API=

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
.vercel
7+
.env.development.local
8+
.env.test.local
9+
.env.production.local

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Run `npm i ` cloned directory and `npm run dev` to serve the site.
2+
3+
## It's a custom hook of useFetch
4+
5+
## If you're fetching the data on different components and using axios / fetch again and again then , this code gonna help you. 😀
6+
7+
## I made a simple custom react hook to fetch the data .
8+
9+
### import the `useFetch` in your component's and pass an url to it :
10+
11+
## and `useFetch ` returns you three values , `loading, data, error`
12+
13+
#### Example <code>const {loading, data, error} = useFetch("https://api.com/users) </code>
14+
15+
### Use it as per you need
16+
17+
## Demo and Live link
18+
19+
<a href="https://usefetch-custom-hook.vercel.app/" title="useFeth Custom Hook">useFeth Custom Hook </a>
20+
21+
### If you like it please start it and contribute to my projects 😀

index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)