diff --git a/src/App.js b/src/App.js index 6c4a97c..5322b17 100644 --- a/src/App.js +++ b/src/App.js @@ -14,11 +14,11 @@ class App extends Component { }) } removeContact = (contact) => { - this.setState((state) => ({ - contacts: state.contacts.filter((c) => c.id !== contact.id) - })) - - ContactsAPI.remove(contact) + ContactsAPI.remove(contact).then(contact => { + this.setState(state => ({ + contacts: state.contacts.concat([contact]) + })) + }) } createContact(contact) {