I have this reducer function and I am incrementing the value of voteScore by 1 inside it. Is this the right way to do it without breaking the constraint that reducer function should be pure function?
function comment (state = {}, action) {
...
switch(action.type) {
...
case UP_VOTE_COMMENT:
const upVoteScore = parseInt(state[id]['voteScore'], 10) + 1
return {
...state,
[id]: {
...state[id],
voteScore: upVoteScore
}
}
}
}