Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube video categories reducer function
function reduceFetchVideoCategories(response, prevState) {
const categoryMapping = response.items.reduce((accumulator, category) => {
accumulator[category.id] = category.snippet.title;
return accumulator;
}, {});
return {
...prevState,
categories: categoryMapping,
};
}
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.