Skip to content

Commit c9816d5

Browse files
committed
Create CommentList.jsx
1 parent 9336017 commit c9816d5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
import Comment from './Comment.jsx';
3+
4+
class CommentList extends React.Component {
5+
render() {
6+
if (!this.props.comments.length) {
7+
return null;
8+
}
9+
var commentNodes = this.props.comments.map((comment, index) => {
10+
return <Comment author={comment.author} text={comment.text} key={index} />;
11+
});
12+
return (
13+
<div>
14+
<h2>Comments</h2>
15+
{commentNodes}
16+
</div>
17+
);
18+
}
19+
}
20+
21+
export default CommentList;

0 commit comments

Comments
 (0)