Skip to content

Instantly share code, notes, and snippets.

@domyen
Last active May 11, 2017 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domyen/f7b44b15e6e0d607878920e3fa5e5e0f to your computer and use it in GitHub Desktop.
Save domyen/f7b44b15e6e0d607878920e3fa5e5e0f to your computer and use it in GitHub Desktop.
CommentList.js (GOOD)
import React from 'react';
export default function CommentList({comments}) {
return (
<div className="commentList">
{comments.map(({text, author: {name, avatar, url}}) => (
<div className="commentItem">
<div className="avatar"><img src={avatar} /></div>
<div className="message">
<span className="author"><a href={url}>{name}</a></span>
<span>{text}</span>
</div>
</div>
))}
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment