MCPcopy Create free account
hub / github.com/coderarmy-notes/mern-stack-course / App

Function App

04React/Day05/vite-project/src/App.jsx:4–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2// [<img>]
3
4function App(){
5
6 const [users,setUsers] = useState([]);
7 // const [name,setName] = useState("");
8 const [count,setCount] = useState(30);
9
10
11 useEffect(()=>{
12
13 async function GithubProfile() {
14
15 const response = await fetch(`https://api.github.com/users?per_page=${count}`);
16 const data = await response.json();
17 setUsers(data);
18 console.log("Hello");
19 }
20
21 GithubProfile();
22
23 },[count])
24
25 // function handleChange(e){
26 // setName(e.target.value.toUpperCase());
27 // }
28
29 return (
30 <>
31 <h1>Github User</h1>
32 <input type="number" value={count} onChange={(e)=>setCount(e.target.value)}></input>
33 <div style={{display:"flex", justifyContent:"center", alignItems:"center", flexWrap:"wrap" , gap:"10px"}}>
34 {
35 users.map(user=>(
36 <img src={user.avatar_url} height={"100px"} width={"100px"} key={user.login}/>
37 ))
38 }
39 </div>
40 </>
41 )
42}
43
44export default App;

Callers

nothing calls this directly

Calls 1

GithubProfileFunction · 0.85

Tested by

no test coverage detected