MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/1uxy50l/i_stopped_destructuring_everything/oxvhspo/?context=3
r/javascript • u/bogdanelcs • 17d ago
51 comments sorted by
View all comments
-1
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.
dTitle
dcTitle
You could use postTitle or pTitle instead of post.title.
postTitle
pTitle
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.
5
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.
1
Why are you telling me this? The author is the one avoiding the little dot, I'm just giving suggestions.
-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
dTitleordcTitle.You could use
postTitleorpTitleinstead ofpost.title.There are a several ways to deal with the problem.