Destructuring a Nested Object
Below is the example.
const obj = { k1: { k11: 1 } };
const {
k1: { k11 },
} = obj;
// console.log(k1); // Error: k1 is not defined
console.log(k11); // 1
This can be useful when you want to change 'e.target.value' into 'value' in event handling.
Below is the example.