diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index c83e263..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["esbenp.prettier-vscode"] -} diff --git a/src/App.jsx b/src/App.jsx index 3ceafc0..9f44d44 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -7,18 +7,10 @@ import Layout from "./components/Layout/Layout"; function App() { const [search, setSearch] = useState(""); const [type, setType] = useState(""); - const [countStar, setCountStar] = useState(0); - - useEffect(() => { - fetch("https://api.github.com/repos/devvsakib/github-error-solve") - .then((response) => response.json()) - .then((data) => setCountStar(data.stargazers_count)) - .catch((error) => console.error("Error fetching GitHub stars:", error)); - }, []); -console.log(countStar) + return ( <> - + diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 76e9fe0..6581735 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -11,11 +11,19 @@ import { Link } from "react-router-dom"; import { HiMoon, HiSun } from "react-icons/hi"; import { ThemeContext } from "../../context/ThemeContext"; -import { useContext, useState } from "react"; +import { useContext, useState, useEffect} from "react"; -function Header({ countStar, notice }) { +function Header({notice }) { const { theme, toggleTheme } = useContext(ThemeContext); const [open, setOpen] = useState(false); + const [countStar, setCountStar] = useState(0); + + useEffect(() => { + fetch("https://api.github.com/repos/devvsakib/github-error-solve") + .then((response) => response.json()) + .then((data) => setCountStar(data.stargazers_count)) + .catch((error) => console.error("Error fetching GitHub stars:", error)); + }, []); const navLink = [ { diff --git a/src/components/Layout/Layout.jsx b/src/components/Layout/Layout.jsx index d6480ac..5b817ee 100644 --- a/src/components/Layout/Layout.jsx +++ b/src/components/Layout/Layout.jsx @@ -13,7 +13,6 @@ const Layout = ({ stars, children }) => {