From 6109fb62c549775144b15100d00a72988624af07 Mon Sep 17 00:00:00 2001 From: vijayrana177 <137168484+vijayrana177@users.noreply.github.com> Date: Tue, 20 Jun 2023 16:53:27 +0530 Subject: [PATCH] Create contactview --- contactview | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 contactview diff --git a/contactview b/contactview new file mode 100644 index 0000000..0241238 --- /dev/null +++ b/contactview @@ -0,0 +1,28 @@ +import React, { useState ,useEffect } from 'react' +//contact view + const Contactview =() => { + const [contact , setContact] = useState([]); + + useEffect(()=>{ +//Fetch JSON data for set contact state + const fetchdata = async () => { +try{ + const response = await fetch ('sample.json'); + const data = await response.json(); + setContacts{data.contact} +} catch(error){ + console.error('Error fecthing Contacts',error); +} +}; + fetchData(); +},[]); + + const handelDeleteContact = (contactId) => {} +//Remove Contacts from local state + setContacts((prevContacts) => + preContacts.filter((contact) => contact.Id !== contactId) + ); + }; + return( + ); + };