My Redux state has the following structure:
const state = {
transactions: {
1: {
TransactionId: 1, Status: "Pending", Type: "Withdrawal", ClientName: "Paul Carter", Amount: "$28.43"
},
2: {
TransactionId: 2, Status: "Completed", Type: "Refill", ClientName: "Caldwell Reid", Amount: "$45.16"
},
...
}
What is the correct way to update/delete an object from transactions given that I have an id ?
Here is how I tried to update Status property in my reducer but it didn't seem to work, my state remains unchanged.
const transactionsReducer = (state, action) => {
case CHANGE_TRANSACTION_STATUS:
return {
[state.transactions[action.id].Status]: action.status
}
}