Join egghead, unlock knowledge.

Want more egghead? It's 45% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 45% Off

Already subscribed? Sign In

Save 45% for a limited time.

Get access to all courses and lessons on egghead today.

Autoplay

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

    Jason BrownJason Brown

    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.

    react-nativeReact Native
    0.35 - 0.37
    reactReact
    ^15.0.0
    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    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.

    Discuss

    Discuss