Created
November 4, 2018 13:42
-
-
Save productioncoder/11ddd7cbf3cd2e0aa81a49c5f7cfb1c2 to your computer and use it in GitHub Desktop.
Youtube in React: make VideoMetadata dynamic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
export function VideoMetadata(props) { | |
if (!props.video || !props.video.statistics) { | |
return <div/>; | |
} | |
const viewCount = Number(props.video.statistics.viewCount).toLocaleString(); | |
return ( | |
<div className='video-metadata'> | |
<h3>{props.video.snippet.title}</h3> | |
<div className='video-stats'> | |
<span>{viewCount} views</span> | |
{/*...*/} | |
</div> | |
<Divider/> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment