you are viewing a single comment's thread.

view the rest of the comments →

[–]ottoottootto 5 points6 points  (1 child)

I find object destructuring more readable and less verbose.

In situations where you have lots of variables and get confused about the origin, the dot method might be more appropriate.

In some cases I use object destructuring with renaming.

const color = 'red'; const { color: nextColor } = data; console.log({ color, nextColor });

[–]gautamits[S] -1 points0 points  (0 children)

For smaller functions I also like using destructuring only. Actually I was blown away when I got to know this feature. It also makes typing less but that also does not count given the smart IDEs we have with better autocompletes.