Hello Alejandro and thanks for response.
As I describe in the article and try to summarize here:
- It's more DRY.
- It is declarative.
- It avoids JS to dig into deep data structures multiple times.
- It is safer, with the habit of including defaults. They also go well together with default parameters in function headers, which is a nice and common syntax that work the same way as destructuring defaults.
- It can keep the scope cleaner, free from variables that you don't need.
- You can utilize the powerful rest operator (both for objects & arrays).
Consider that you in some function need:
`profile.user.address.street.number` & `profile.user.address.city`
Without destructuring you'd have to type:
`profile?.user?.address?.street?.number ?? ""` & `profile?.user?.address?.city ?? ""`
With destructuring, made as early as possible in a suitable way for the situation, you know that you have safe short values to work with:
`streetNumber` & `city`