Skip to content

Instantly share code, notes, and snippets.

@bismitaguha
Created July 13, 2020 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bismitaguha/69afc65ed0639df158d8571e1f3837e0 to your computer and use it in GitHub Desktop.
Save bismitaguha/69afc65ed0639df158d8571e1f3837e0 to your computer and use it in GitHub Desktop.
const listReducer = (state = initialState, action) => {
switch(action.type) {
case UPDATE_LIST:
return {
...state,
postobject: action.payload,
list: [...state.list.filter(
object => object.id !== action.payload.id
), action.payload]
};
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment