I would like to merge to two object into one in this example: https://codesandbox.io/s/vibrant-flower-y6c76
const orig = {
123: '123',
abc: {
p3: 'p3',
p4: 'p4',
},
}
const extended = {
abc: {
p1: 'p1',
p2: 'p2',
// ...orig.abc
},
def: 'def',
...orig,
}
So that the extended object becomes:
{
abc: {
p1: 'p1',
p2: 'p2',
p3: 'p3',
p4: 'p4'
},
def: 'def',
123: '123',
}
But right now the extended looks like below and it seems abc in orig overrides the one in extended. What is the right way to make it happen?