In Redux, is it necessary to do deep copy

后端 未结 3 1801
逝去的感伤
逝去的感伤 2020-12-30 20:09

The below object is action.data has a nested object address

{
    name: \'Ben\',
    address: {
        country: \'Australia\',
            


        
3条回答
  •  时光说笑
    2020-12-30 20:56

    No, shallow copy of Unchanged properties.
    Changed properties will be anyway new values, so no question of type of copy.

    In code we achieve it like this return {...prevState}

提交回复
热议问题