O'Reilly logo

React Native By Example by Richard Kho

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding comments to PostView

In this next step, we will edit PostView so that it includes a ListView to render all its comments. Since PostView will have the comments data saved into its state once the information has been loaded by the componentWillMount life cycle, we can use that data to render the comments.

Start by creating a component to house this ListView; let's call it CommentList. It should do the following:

  • Contain a list of comments, passed to it by PostView as a prop
  • Render a ListView using those comments
  • The rows should be rendered by a child component, CommentListRow

Your CommentListRow component should do the following:

  • Each row should contain its poster's name and the message they wrote
  • Separate each comment with a ListView ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required