MCPcopy Create free account
hub / github.com/CodeWithHarry/Sigma-Web-Dev-Course / App

Function App

Video 113/src/App.jsx:5–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import './App.css'
4
5function App() {
6 const [cards, setCards] = useState([])
7
8 const fetchData = async () => {
9 let a = await fetch("https://jsonplaceholder.typicode.com/posts")
10 let data = await a.json()
11 setCards(data)
12 console.log(data)
13 }
14
15 useEffect(() => {
16 fetchData()
17 }, [])
18
19
20 return (
21 <>
22 <Navbar/>
23 <div className="container">
24 {cards.map((card)=>{
25 return <div key={card.id} className="card">
26 <h1>{card.title}</h1>
27 <p>{card.body}</p>
28 <span>By: UserId: {card.userId} </span>
29 </div>
30
31 })}
32
33 </div>
34
35 </>
36 )
37}
38
39export default App

Callers

nothing calls this directly

Calls 1

fetchDataFunction · 0.85

Tested by

no test coverage detected