Closed deepankar14693 closed 5 years ago
Here you are changing the item but after de-structuring data array you are not updating the manipulated item. Can you please explain because according to my knowledge de-structuring prevents mutability and gives an exact copy
case Actions.AC_UPDATE_TASK: debugger item = action.payload.item; props = action.payload.props; console.log('update item', item); console.log('update prop', props); item.start = props.start ? props.start : item.start; item.end = props.end ? props.end : item.end; item.name = props.name ? props.name : item.name; return { data: [...state.data], links: [...state.links], selectedItem: state.selectedItem };
Here you are changing the item but after de-structuring data array you are not updating the manipulated item. Can you please explain because according to my knowledge de-structuring prevents mutability and gives an exact copy
case Actions.AC_UPDATE_TASK: debugger item = action.payload.item; props = action.payload.props; console.log('update item', item); console.log('update prop', props); item.start = props.start ? props.start : item.start; item.end = props.end ? props.end : item.end; item.name = props.name ? props.name : item.name; return { data: [...state.data], links: [...state.links], selectedItem: state.selectedItem };