I am trying to set a part of the state inside a reducer but I need to access part of the initial state that is nested.
What I am trying to do:
return {
...state,
list: action.payload,
filter: action.params,
filter.totalPages : action.totalPages,
};
This however does not working, I have tried doing filter['totalPages'] and it also does not work. How and what is the best practice to do this?