Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Crismon2344yBenefits are multiple.
You can see the properties that are used all in one place.
You DO reduce redundant code. The example you gave is redundant but usually you use more than one prop.
You can alias properties, which allows short syntax in property assignment somewhere else.
I could go on but in many cases except your given it does make sense. Dont you like it as well? This is the syntactic sugar other languages dream of. -
mojo20127834yI prefer the OP‘s way with object property access, bc it‘s clearer and easier to read and understand.
Readability is the key to a good codebase. -
iiii90854y@Pierreburton91 if you need an external tool to understand the origin of shit you're working with, then you are doing something VERY wrong
-
iiii90854y@Pierreburton91 using an IDE search is already an external tool. If you cannot just look at the code and understand it without hopping around then the code is a fucking pile of spaghetti.
Related Rants
People who use destructuring assignment EVERYWHERE; why you do this to me?
In most cases it does not even reduce code length. Like
{ field } = object
save(field)
Why no just type
save(object.field)
Tis' hard to understand
random
js