Last active
April 29, 2017 13:50
-
-
Save yhaskell/55b3b2ec62ed6d4f221d4b5921ba8487 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PhoneList extends Component { | |
onRemovePhone(phone) { | |
fetch(`${this.props.apiUrl}/${phone.id}`, { | |
method: "delete", | |
credentials: "same-origin" | |
}).then(() => { | |
this.setState(state => ({ phones: state.phones.filter(p => p.id != phone.id) })) | |
}) | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment