Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube in React: video details and related videos
function reduceWatchDetails(responses, prevState) {
const videoDetailResponse = responses.find(r => r.result.kind === VIDEO_LIST_RESPONSE);
// we know that items will only have one element
// because we explicitly asked for a video with a specific id
const video = videoDetailResponse.result.items[0];
const relatedEntry = reduceRelatedVideosRequest(responses);
return {
byId: {
[]: video
related: {
[]: relatedEntry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment