const [restaurantsData,setrestaurantsData]=useState([]) useEffect(()=>{ const getData = async () => { await fetch('http://localhost:5000/api/v1/res/') .then((response) => response.json()) .then((json) => {setrestaurantsData(json.data),console.log(restaurantsData)}) .catch((error) => console.error(error)) .finally(); }; getData(); console.log(id) console.log("photo",restaurantsData.photo) },[]) useEffect(()=> { for (const {type: t} of menuDetailedData) { routes.push({key:i,title:t}) i++; } console.log("routes",routes) let acc=[] for(let i=0; i<menuDetailedData.length-1;i++) { if(routes[i].title===routes[i+1].title) { acc.push(routes[i]) } } setroutes(routes.filter(item => !acc.includes(item))) console.log("acc",acc) },[])
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)