File tree 3 files changed +12
-13
lines changed
3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -7,18 +7,10 @@ import Layout from "./components/Layout/Layout";
7
7
function App ( ) {
8
8
const [ search , setSearch ] = useState ( "" ) ;
9
9
const [ type , setType ] = useState ( "" ) ;
10
- const [ countStar , setCountStar ] = useState ( 0 ) ;
11
-
12
- useEffect ( ( ) => {
13
- fetch ( "https://api.github.com/repos/devvsakib/github-error-solve" )
14
- . then ( ( response ) => response . json ( ) )
15
- . then ( ( data ) => setCountStar ( data . stargazers_count ) )
16
- . catch ( ( error ) => console . error ( "Error fetching GitHub stars:" , error ) ) ;
17
- } , [ ] ) ;
18
- console . log ( countStar )
10
+
19
11
return (
20
12
< >
21
- < Layout stars = { countStar } >
13
+ < Layout >
22
14
< SearchInput search = { search } setSearch = { setSearch } setType = { setType } />
23
15
< Error search = { search } type = { type } />
24
16
</ Layout >
Original file line number Diff line number Diff line change @@ -10,11 +10,19 @@ import { Link } from "react-router-dom";
10
10
11
11
import { HiMoon , HiSun } from "react-icons/hi" ;
12
12
import { ThemeContext } from "../../context/ThemeContext" ;
13
- import { useContext , useState } from "react" ;
13
+ import { useContext , useState , useEffect } from "react" ;
14
14
15
- function Header ( { countStar , notice } ) {
15
+ function Header ( { notice } ) {
16
16
const { theme, toggleTheme } = useContext ( ThemeContext ) ;
17
17
const [ open , setOpen ] = useState ( false ) ;
18
+ const [ countStar , setCountStar ] = useState ( 0 ) ;
19
+
20
+ useEffect ( ( ) => {
21
+ fetch ( "https://api.github.com/repos/devvsakib/github-error-solve" )
22
+ . then ( ( response ) => response . json ( ) )
23
+ . then ( ( data ) => setCountStar ( data . stargazers_count ) )
24
+ . catch ( ( error ) => console . error ( "Error fetching GitHub stars:" , error ) ) ;
25
+ } , [ ] ) ;
18
26
19
27
const navLink = [
20
28
{
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ const Layout = ({ stars, children }) => {
13
13
< div className = 'flex flex-col justify-between min-h-screen' >
14
14
< ThemeProvider >
15
15
< Header
16
- countStar = { stars }
17
16
notice = { "Under Construction" }
18
17
/>
19
18
< div className = 'relative' >
You can’t perform that action at this time.
0 commit comments