azrizhaziq
1 min readAug 15, 2018

--

Hi, I also do face this problem sometimes, and i come out with another approach

const oldData = {
manual_timezone: ‘GMT (+5.30)’,
role: ‘Admin’,
isDisabled: true
};
const uiFormData = {
role: ‘your_newRole’,
isDisabled: false
};
let newData = {
...oldData,
...uiFormData
} // or you can use Object.assign(...)

this will let uiFormData to merge with oldData you get from api.

--

--

No responses yet