Skip to content

Instantly share code, notes, and snippets.

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

Embed
What would you like to do?
Youtube most popular videos reducer
import {createSelector} from 'reselect';
/*
...
rest unchanged
*/
/*
* Selectors
* */
export const getMostPopularVideos = createSelector(
(state) => state.videos.byId,
(state) => state.videos.mostPopular,
(videosById, mostPopular) => {
if (!mostPopular || !mostPopular.items) {
return [];
}
return mostPopular.items.map(videoId => videosById[videoId]);
}
);
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.