Skip to content

Instantly share code, notes, and snippets.

@nayunhwan
Created December 28, 2016 07:08
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 nayunhwan/b286d22da3722ff6a94c36c927118973 to your computer and use it in GitHub Desktop.
Save nayunhwan/b286d22da3722ff6a94c36c927118973 to your computer and use it in GitHub Desktop.
React Extracting Component Example
function Comment(props) {
return (
<div className="Comment">
<div className="UserInfo">
<img className="Avatar"
src={props.author.avatarUrl}
alt={props.author.name}
/>
<div className="UserInfo-name">
{props.author.name}
</div>
</div>
<div className="Comment-text">
{props.text}
</div>
<div className="Comment-date">
{formatDate(props.date)}
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment