I'm updating some values as a javascript object inside my reducer in reactjs like below.
this is the object before the update
state = {
  result:1,
  lastval: []
}
and this is how I'm going to update it,
state = {
      ...state,
      result:state.result + 400,
      lastval: result.lastval.push(20)
    }
so this gives me an error of state.lastValue.push is not a function. but if I do it like below it is fine,
state = {
          ...state,
          result:state.result + 400,
        };
        state.lastval.push(20);
this is fine. what is the reason.
 
     
    