'use client'; import { useState } from 'react'; import Image from 'next/image'; import Link from 'next/link'; import deleteProperty from '@/app/actions/deleteProperty'; const ProfileProperties = ({ properties: initialProperties }) => { const [properties, setProperties] = useState(initialProperties); const handleDeleteProperty = async (propertyId) => { const confirmed = window.confirm( 'Are you sure you want to delete this property?' ); if (!confirmed) return; const deletePropertyById = deleteProperty.bind(null, propertyId); await deletePropertyById(); const updatedProperties = properties.filter( (property) => property._id !== propertyId ); setProperties(updatedProperties); }; return properties.map((property) => (

{property.name}

Address: {property.location.street} {property.location.city}{' '} {property.location.state}

Edit
)); }; export default ProfileProperties;