2 Matching Annotations
- Jul 2018
const shopItemsSelector = state => state.shop.items const taxPercentSelector = state => state.shop.taxPercent
This is a selector
const subtotalSelector = createSelector( shopItemsSelector, items => items.reduce((acc, item) => acc + item.value, 0) )
This is a memoized selector. items.reduce will be evaluated during the first call. Any subsequent call with the same parameters will return the result without computing items.reduce.