Created
October 1, 2018 15:59
-
-
Save i-oliva/c51cf8ee1552ecc19adac62defc78fe6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reducer = (state, action) => { | |
const { results } = state; | |
switch (action.type) { | |
case 'DELETE_ELEMENT': | |
return { | |
...state, | |
results: results.filter(result => { | |
return result.email !== action.payload; | |
}) | |
}; | |
case 'ADD_CONTACT': | |
return { | |
...state, | |
localUsers: [action.payload, ...state.localUsers] | |
}; | |
default: | |
return state; | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment