Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube: watch details reducer: quick and dirty implementation
function reduceWatchDetails(responses, prevState) {
let byIdEntry = {};
if (responses && responses[0].result.items) {
const video = responses[0].result.items[0];
byIdEntry = {[video.id]: video};
}
return {
...prevState,
byId: {
...prevState.byId,
...byIdEntry,
},
};
}
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.