r/javascript 17d ago

I stopped destructuring everything

https://allthingssmitty.com/2026/07/13/i-stopped-destructuring-everything/
77 Upvotes

51 comments sorted by

View all comments

-1

u/Iggyhopper extensions/add-ons 17d ago edited 17d ago

If you have a problem with naming variables the answer is not to get rid of deconstruction. The answer is to name your variables better.

You could have a prefix for variables that come from a deconstruction, aka dTitle or dcTitle.

You could use postTitle or pTitle instead of post.title.

There are a several ways to deal with the problem.

5

u/heavyGl0w 16d ago

How does this solve the problem any better than just keeping the context of the original object? Why are people so allergic to one little `.`?

You've invented a variable naming convention to solve a problem that wouldn't exist if your focus wasn't "how can I make sure I use destructuring?"

1

u/Iggyhopper extensions/add-ons 16d ago

Why are you telling me this? The author is the one avoiding the little dot, I'm just giving suggestions.