2 ms·
Completely tangential, but you can also do the opposite with nesting, which I learned about literally yesterday: const { some: { nested: { field } } } = tree;
by anonytrary 8y ago
Completely tangential, but you can also do the opposite with nesting, which I learned about literally yesterday:
const { some: { nested: { field } } } = tree;
// field === tree.some.nested.field
or rename things while you destructure them:
const { crappyFieldName: betterName } = myObject;
// betterName === myObject.crappyFieldName
Now I can't stop using this feature...