Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/videos.js
Last active Oct 28, 2018

What would you like to do?
Youtube get videos by category selector
export const getVideosByCategory = createSelector(
state => state.videos.byCategory,
state => state.videos.byId,
state => state.videos.categories,
(videosByCategory, videosById, categories) => {
return Object.keys(videosByCategory || {}).reduce((accumulator, categoryId) => {
const videoIds = videosByCategory[categoryId].items;
const categoryTitle = categories[categoryId];
accumulator[categoryTitle] = => videosById[videoId]);
return accumulator;
}, {});
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.