Skip to content

Instantly share code, notes, and snippets.

@IrakliJani
Created July 30, 2016 19:12
Show Gist options
  • Save IrakliJani/049bf83b25ddde9ee3a5d3ff2464cf8a to your computer and use it in GitHub Desktop.
Save IrakliJani/049bf83b25ddde9ee3a5d3ff2464cf8a to your computer and use it in GitHub Desktop.
Listening actions in different reducers
function usersReducer (state = Map(), action) {
switch (action.type) {
...
case REMOVE_USER:
return state.delete(action.id)
...
}
}
function tasksReducer (state = Map(), action) {
switch (action.type) {
...
case REMOVE_USER:
return state.filter(task => task.user_id !== action.id)
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment