Skip to content

Instantly share code, notes, and snippets.

@Ledoux
Last active April 8, 2019 23:07
Show Gist options
  • Save Ledoux/0647e1602eaf45e3a97a1a302d06fe90 to your computer and use it in GitHub Desktop.
Save Ledoux/0647e1602eaf45e3a97a1a302d06fe90 to your computer and use it in GitHub Desktop.
import { createSelector } from 'reselect'
const selectOfferById = createSelector(
state => state.data.offers,
(state, offerId) => offerId,
(offers, offerId) => (offers || []).find(offer => offer.id === offerId)
)
export default selectOfferById
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment