Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active November 24, 2018 16:05
Embed
What would you like to do?
Youtube in React: video list generating VideoPreview elements
getVideoPreviews() {
if(!this.props.videos || !this.props.videos.length) {
return null;
}
const firstVideo = this.props.videos[0];
if (!firstVideo.snippet.description) {return null}
return this.props.videos.map(video => (
<VideoPreview horizontal={true} expanded={true} video={video} key={video.id} pathname={'/watch'}
search={'?v=' + video.id}/>)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment