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

Jason Brown
InstructorJason Brown

Share this video with your friends

Send Tweet
Published 6 years ago
Updated 3 years ago

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.

[00:00] 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.

[00:21] 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.