const [people, setPeople] = useState(data); const handleRemove = (id) => { const newPeople = people.filter((person) => person.id !== id); setPeople( newPeople); }; <button onClick={() => handleRemove(id)}>Remove</button>