Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Last active November 16, 2018 19:09
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/6673e9c8f88abde56b4b9505bd6c1181 to your computer and use it in GitHub Desktop.
Save productioncoder/6673e9c8f88abde56b4b9505bd6c1181 to your computer and use it in GitHub Desktop.
Youtube in React: pull in comments for a specific video
import {getCommentsForVideo} from '../../../store/reducers/comments';
class WatchContent extends React.Component {
render() {
{/* ... */}
<Comments comments={this.props.comments} amountComments={112499}/>
{/* ... */
}
}
/* ... */
function mapStateToProps(state, props) {
return {
relatedVideos: getRelatedVideos(state, props.videoId),
video: getVideoById(state, props.videoId),
channel: getChannel(state, props.channelId),
comments: getCommentsForVideo(state, props.videoId),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment