const a = { b: { c: \'Hi!\' } }; const { b: { c } } = a;
Is it possible rename b in this case? I want get c and also
b
c
You can destructure the same property multiple times, onto different targets:
const { b: {c}, b: d } = a;
This assigns a.b.c to c and a.b to d.
a.b.c
a.b
d