From 8564f92d030c589dce0b13091220e29d387932f1 Mon Sep 17 00:00:00 2001 From: SalmanPathan Date: Sat, 18 Jan 2025 13:54:25 +0530 Subject: [PATCH] Update the github page --- .../src/components/Github/Github.jsx | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/07reactRouter/src/components/Github/Github.jsx b/07reactRouter/src/components/Github/Github.jsx index 9669a2b..2568794 100644 --- a/07reactRouter/src/components/Github/Github.jsx +++ b/07reactRouter/src/components/Github/Github.jsx @@ -1,28 +1,43 @@ -import React, { useEffect, useState } from 'react' -import { useLoaderData } from 'react-router-dom' +import React, { useEffect, useState } from "react"; +import { useLoaderData } from "react-router-dom"; function Github() { - const data = useLoaderData() - // const [data, setData] = useState([]) - // useEffect(() => { - // fetch('https://api.github.com/users/hiteshchoudhary') - // .then(response => response.json()) - // .then(data => { - // console.log(data); - // setData(data) - // }) - // }, []) - + const data = useLoaderData(); + // const [data, setData] = useState([]) + // useEffect(() => { + // fetch('https://api.github.com/users/hiteshchoudhary') + // .then(response => response.json()) + // .then(data => { + // console.log(data); + // setData(data) + // }) + // }, []) + return ( -
Github followers: {data.followers} - Git picture +
+ Github followers: {data.followers} + Git picture + + +
- ) + ); } -export default Github +export default Github; export const githubInfoLoader = async () => { - const response = await fetch('https://api.github.com/users/hiteshchoudhary') - return response.json() -} \ No newline at end of file + const response = await fetch("https://api.github.com/users/hiteshchoudhary"); + return response.json(); +};