Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Last active May 22, 2018 08:01
Show Gist options
  • Save kettanaito/8d556fbf5219ab6c3db3b849516663ec to your computer and use it in GitHub Desktop.
Save kettanaito/8d556fbf5219ab6c3db3b849516663ec to your computer and use it in GitHub Desktop.
Redux - Selector
// cart/selectors.js
export const getTotalPrice = (cart) => {
return cart.get('items').reduce((acc, item) => {
return acc + item.get('price')
}, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment