Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 17, 2018 08:55
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 productioncoder/3a6a612a009faf39bd5980f1b0a9a6a4 to your computer and use it in GitHub Desktop.
Save productioncoder/3a6a612a009faf39bd5980f1b0a9a6a4 to your computer and use it in GitHub Desktop.
Youtube in React: make single comment dynamic
export function Comment(props) {
if (!props.comment) {
return <div/>;
}
const topLevelComment = props.comment.snippet.topLevelComment;
const {authorProfileImageUrl, authorDisplayName, textOriginal} = topLevelComment.snippet;
const likeCount = topLevelComment.snippet.likeCount;
return (
<div className='comment'>
<Image className='user-image' src={authorProfileImageUrl} circular />
<div>
<div className='user-name'>{authorDisplayName}</div>
<span>{textOriginal}</span>
<div className='comment-actions'>
<Rating likeCount={likeCount}/> <Button size='mini' compact>REPLY</Button>
</div>
</div>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment