Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jason Gretz jagretz

🎯
Focusing
View GitHub Profile
View reduxSelectorPattern.md

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default: