Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube in React: make VideoMetadata dynamic
/* ... */
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
You can’t perform that action at this time.