import {useState,useEffect} from 'react'
const FakeApi=() => new Promise((resolve)=>{
setTimeout(()=>{
resolve([{
id:1,
name:"ANjali",
age:12,
},
{
id:1,
name:"Addu",
age:12,
}
])
},3000)
});
export default function App() {
const [data,setdata]=useState([]);
useEffect(()=>{
const fetchresult=async()=>{
const result=await FakeApi()
setdata(result)
}
fetchresult()
},[])
return (
id | name | age |
---|---|---|
{item.id} | {item.name} | {item.age} |
)
}
Top comments (0)