0
export interface Address {
    id: string,
    formData: FormData,
    addressData: AddressData,
    documentsData: DocumentsData
}

export interface AddressData {
    professional: AddressProfessional;
}

export interface AddressProfissional {
    typeA: AddressTypeA[];
    typeB: AddressTypeB[];
}

export interface AddressTypeA {
   name: string;
   surname: string;
   address: string;
   city: string;
   country: string;
}

我可以更新商店,但不确定更新嵌套状态的最佳方法是什么,例如,如果我想更新 addressData -> AddressTypeA 并仅更新正在发送的 {name & surname} 对象

functionUpdateStore(data  => {
     this.store.update(state => ({
        ...state,
        addressData: data,
     }))
});

发送有效载荷以更新存储:名称:字符串;姓氏:字符串;

当前商店正在更新,但不在嵌套属性中。更新嵌套对象状态的最佳方法是什么?

4

0 回答 0