Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube pull most popular videos into HomeContent
import {VideoGrid} from '../../../components/VideoGrid/VideoGrid';
import React from 'react';
import './HomeContent.scss';
import {getMostPopularVideos} from '../../../store/reducers/videos';
import {connect} from 'react-redux';
class HomeContent extends React.Component {
render() {
const trendingVideos = this.getTrendingVideos();
return (
<div className='home-content'>
<div className="responsive-video-grid-container">
<VideoGrid title='Trending' videos={trendingVideos}/>
getTrendingVideos() {
return this.props.mostPopularVideos.slice(0, AMOUNT_TRENDING_VIDEOS);
function mapStateToProps(state) {
return {
mostPopularVideos: getMostPopularVideos(state),
export default connect(mapStateToProps, null)(HomeContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment