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

Jason Brown
InstructorJason Brown
Share this video with your friends

Social Share Links

Send Tweet
Published 7 years ago
Updated 5 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.

egghead
egghead
~ 15 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today