We'll start by rendering a TouchableOpacity. Inside of there, we'll create a text element and say ClearCompleted. Now if we go over and we refresh, you can see that we have a ClearCompleted button rendering and there's space around all of the items. Now we'll go add an onPress to our TouchableOpacity and say this.props.onClearCompleted.
Now, we'll switch back to our app and we'll add a handle ClearCompleted to be a function. Go ahead and bind this, this.handleClearCompleted = this.handleClearCompleted.bind(this). Now, we'll type const newItems = filterItems active, so we'll filter our items for only the active items, which will remove our completed items. We'll then say this.setSource and give it our new items, so we'll replace our array of items.
We'll also filter items, this.state.filter and apply the filter to the new, the only active items. Now, we'll pass this into our footer. We'll say onClearCompleted = this.handleClearCompleted. When we go and we refresh our emulator, we can add an item, add another, you can toggle one of these to complete and click ClearCompleted and see that it disappeared.