3 ms·
That <if(user.loggedOut)> <a href="/login">Log in</a> </if> And that <ul> <for|color, index| of=colors> <li>${index}:
by LudwigNagasena 4y ago
That
<if(user.loggedOut)>
<a href="/login">Log in</a>
</if>
And that
<ul>
<for|color, index| of=colors>
<li>${index}: ${color}</li>
</for>
</ul>
Looks scary. ${index} and ${color} require escaping, (user.loggedOut) requires parentheses and |color, index| requires pipes. I just don’t understand what is going on.
What I like React for is that I can use JavaScript for things that seem to belong to JavaScript, like conditionals and loops. And components just have properties that may be dynamic and conditioned, in which case they obviously require JavaScript. But here the syntax breaks that separation of concerns IMO.