2 ms·
When a programming expression is made significantly more concise via some abstraction, it can be used in new ways that weren't reasonable before. JSX makes exp
by dwaltrip 9y ago
When a programming expression is made significantly more concise via some abstraction, it can be used in new ways that weren't reasonable before.
JSX makes expressing dynamic, declarative DOM markup concise enough that a short expression such as: `items.map(item => <FooItem item={item}/>` is no longer overly obtuse/obfuscating.
If the `map` expression becomes much larger, it might make sense to refactor it out in some way. But I would argue that the important guiding principle here is readability and modularity. Drawing a hard line between flow/control structures and "template code" is not useful, in my mind.
As others have stated in this thread, the more useful distinction is between business logic and presentation. Loops rightfully exist in both of those domains.