r/javascript • u/bogdanelcs • Jul 16 '26
I stopped destructuring everything
https://allthingssmitty.com/2026/07/13/i-stopped-destructuring-everything/
84
Upvotes
r/javascript • u/bogdanelcs • Jul 16 '26
View all comments
Show parent comment
3
u/BasicAssWebDev Jul 16 '26
yeah this is the only time i do something like this. if im consuming a returned object whose properties are necessary for different actions, ill destruct them into the pieces i need in the same declaration line to save on space.
const item1 = obj.thing1const item2 = obj.thing2const itemN = obj.thingNget's a little cumbersome when this works just as well
const {thing1: item1, thing2: item2, thingN: objN} = objholding my breath for someone to mention an edge case where you're destructuring an absurd amount of properties which obviously requires a different strategy.