Untitled

 avatar
unknown
plain_text
a year ago
870 B
16
Indexable
export default function App() {

const[data,setdata]=useState([]);

const fetchfunction =async()=>{
  const data =await fetch("https://dummyapi-two.vercel.app/contactdata");

  const response = await data.json();
  
  setdata(response)
 }; 

useEffect(()=>{
fetchfunction();
  },[])
console.log(data);
  return (
    <View className="bg-slate-500">
      
      <StatusBar style="auto" />
    
     <View className="h-full w-full bg-slate-300 flex justify-start items-center text-red-500 mt-40">

      <Text className="text-3xl font-extrabold mt-5">Api call</Text>
    <ScrollView>
    {
     data.map((data)=>{
      return (
        <View class="bg-red-200 ">
        <Text>{data.name}</Text>
        <Text>{data.email}</Text>
      </View>
      )
      
      
     })
    }
    </ScrollView>
     </View>
    </View>
  );
}