I have a question regarding Redux and updating a value of a nested object.
Let's say this is my initial state:
const INITIAL_STATE = {
columnState: {
1: {
loading: false
},
2: {
loading: false
}
}
};
When my reducer is called:
case COLUMN_STATE_UPDATE:
const { type } = payload;
return {
...state
}
}
How do I update the value of loading for the particular id?
Let's say that I update entry with key = 2, how do I change the value of loading to true for columnState object with key 2, and return the new state?