This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

Add the Total Remaining Item Count to the Footer with React Native Text

0:40 React lesson by

In this lesson we'll add a footer text item to show the total count of what is in the current filtered view. We'll show the technique of deriving computed values in render functions.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

In this lesson we'll add a footer text item to show the total count of what is in the current filtered view. We'll show the technique of deriving computed values in render functions.

We'll start by rendering a text component. We'll say this.props.count, and then type the text count. If we refresh, you can see that no count is rendering. We'll switch back to our app, scroll down to our footer, pass in count=filter items active, because we want to filter for the active items.

We'll pass in this.state.items. Then we will get the length of that. Now that we have the length being passed down, we can refresh, and see that we have a count of zero. We can add an item, which will then increase our count. If we toggle it to complete, it'll drop our count to zero.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?