5 ms·
React component should be chock full of do expressions If the motivation behind these features are React components, javascript clearly lacks proper logic in a
by wruza 4y ago
React component should be chock full of do expressions
If the motivation behind these features are React components, javascript clearly lacks proper logic in array (and object) literals, like
'[' if (cond) […]expr1 [else […]expr2] ']'
Although it seems pretty strange to add syntax only because some specific user interface library together with a specific language extension could benefit from it.
- MathMonkeyMan 4y agoDo you mean this? [cond ? expr1 : expr2] Or maybe this: [(() => {/*code*/})()]
- wruza 4y agoMore like this: [...(cond ? [expr1] : [])]