Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube in React: get comments for video id selector
import {createSelector} from 'reselect';
/* ... */
const getCommentIdsForVideo = (state, videoId) => {
const comment = state.comments.byVideo[videoId];
if (comment) {
return comment.ids;
return [];
export const getCommentsForVideo = createSelector(
state => state.comments.byId,
(commentIds, allComments) => {
return => allComments[commentId]);
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.