Skip to content

Instantly share code, notes, and snippets.

@cpv123
Last active October 16, 2019 06:24
Show Gist options
  • Save cpv123/696be0e8adcddcd895d8e025f7c7244c to your computer and use it in GitHub Desktop.
Save cpv123/696be0e8adcddcd895d8e025f7c7244c to your computer and use it in GitHub Desktop.
import { createSelector } from 'reselect'
export const getIsAuthenticated = state => state.isAuthenticated
export const getIsEligibleForPromo = state => state.isEligibleForPromo
const getBasket = state => state.basket
const getLatestOrderItems = state => state.orders.latest.items
export const getBasketContents = createSelector(
[getBasket, getLatestOrderItems],
(basket, latestOrderItems) => basket.map(item => !lastestOrderItems.includes(item.id))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment