Here is the problem function in my redux slice:
setButtonBackgroundColor: (state, action) => {
const btn = state.list.present.find(
(btn) => btn.id === action.payload.id
);
let copy = Object.assign({}, btn);
state.list.past = [...state.list.past, copy];
btn.style.backgroundColor = action.payload.backgroundColor;
}
When btn.style.backgroundColor is updated, so is copy. Any idea why?