I am trying to add time to the property Elapsed time of entity created by createEntityAdapter, but it's not being updated
I am trying this , i writing code for only this reducer function
const reducers={
updateTime(state, actions) {
const { id, time } = actions.payload;
taskAdapter.updateOne(state, {
id,
changes: (entity) => {
return { ...entity, taskElapsedTime: entity.taskElapsedTime + time }
},
})
}
however if it try the code below it works fine
const reducers={
updateTime(state, actions) {
const { id, time } = actions.payload;
taskAdapter.updateOne(state, {
id,
changes: changes: { taskElapsedTime: state.entities[id].taskElapsedTime + time },
}
but i dont think that it's a cleaner way, can anybody please help