Tuesday, 16 January, 2018 UTC


Summary

In this lesson we will look at updating state in React based on the successful resolution of a promise making use of [Promise.prototype.then](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then). We will perform a user action such as clicking a button to delete an item and fire off a request to our API. Once our request is complete, we will update our [component state](https://reactjs.org/docs/state-and-lifecycle.html#adding-local-state-to-a-class) based on current state using [`setState()` with an updater function](https://reactjs.org/docs/react-component.html#setstate) and remove the target item from the list with [Array.prototype.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).