4 ms·
Maybe because you’re thinking of it like a template language. It is not. It is JavaScript through and through. And mapping over an array is quite idiomatic. So
by ickelbawd 3y ago
Maybe because you’re thinking of it like a template language. It is not. It is JavaScript through and through. And mapping over an array is quite idiomatic. So are ternary operators. If you really prefer you can pop that out into a for loop with a full-blown if statement, but that’s not very common—at least not in React.
I think the long history of being served over the wire drove the community to prefer shorter, more terse code.
- 38 3y ago> Maybe because you’re thinking of it like a template language. I think they just looked at the JavaScript example, and realized how ugly/unreadable it was, and said "I can do better", and they did. the Django example is actually clear and readable about whats going on. the fact that the community converged on the current monstrosity should bring great sadness, not rationalizations.
- ickelbawd 3y agoIt’s not rationalization. It’s preference. There were plenty of templating languages in Javascript before React came along.
- deleted 3y ago[deleted]