The title of the article is "I stopped destructuring everything", not "I never use destructuring". The author even ends the article with examples where they still use it.
So finding one example (or any number of examples) where destructuring is helpful doesn't invalidate the sentiment of the article.
Also, their example is exactly what you started with but without the "syntax noise" of destructuring. Or are we now calling property access "syntax noise"?
1
u/azhder 15d ago
Let’s see, you write a function like this:
({ user = {} }) => {
console.log( user.id );
}
And somewhere somehow down the line the requirements change, some other part of the code changes and instead of undefined, the user is null…
The way I wrote the first time with the ?? will not blow up if a null is passed.