Created
September 12, 2018 09:34
-
-
Save fxck/7f210c6166a360ac8bfa6422f88d7d64 to your computer and use it in GitHub Desktop.
This file contains 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
export function reducer( | |
state = initialState, | |
action: Actions | |
) { | |
switch (action.type) { | |
case ActionTypes.Add: | |
return { data: [ ...state.data, action.payload ] }; | |
case ActionTypes.Remove: | |
return { data: state.data.filter((id) => id !== action.payload) }; | |
} | |
return state; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment