i'm using immutable.js , and i have a redux reducer case where i need to modify a trackslist,
each track has a property of selected
which is a boolean .
what this case does is toggling that property and then calculating the duration of those selected tracks combined .
now my prolem is like this : is it possible to acces the new state in the set
function after updating it , without using a new variable to store the updated state ?
var index = state.get("tracksList").findIndex(e => e.get("id") === action.id);
return state
.updateIn(["tracksList", index, "selected"], e => !e)
// i need to acces the new state here
.set("duration", getDuration(newState.get("tracksList")));