4 ms·
You're exactly right. Arguably worse than ugly, unnecessary and difficult to parse are that many of these things are difficult to research with a search engine.
by jbergknoff 11y ago
You're exactly right. Arguably worse than ugly, unnecessary and difficult to parse are that many of these things are difficult to research with a search engine. For example, `const { user, post } = this.props;` there is nothing to plug in to a search engine (and the meaning is not obvious, even to somebody with plenty of experience in ES5). Same thing with `arr1.push(...arr2);`.
- bengale 11y agoCome off it, destructuring is hardly unique to javascript.
- btdiehr 11y agoDestructuring assignments are extremely useful, especially within function signatures.
- th0br0 11y agoWithout knowing the type of what you're destructuring though, that's quick to land you in some type of undefined hell.
- btdiehr 11y agoWhy wouldn't you know what your destructuring? `({ id, option = true, name = 'unnamed' }) => // ...` replaces ``` function(userObject) { const id = userObject.id; const option = userObject.option || true; const name = userObject.name || 'unnamed'; // ... } ``` I think this comparison speaks for itself. In pre-es6 code bases you TONS of code that looks like the second.
- nly 11y agoWhat syntax would you recommend/prefer for unwrapping 'props'?
- dandare 11y agoThis is a real problem for me these days. I see a new syntax in someone else's codebase and it is very difficult to google it.
- Keepo 11y agoTake a look at this site http://es6-features.org/ http://es6-features.org/ there is even comparison ES6 vs ES5 code. You can just go over every feature really fast a then you may get rough idea where to look next time you feel lost.