by FrancoDiaz · 10y ago · 0 comments
So what's the pain for me, as a user of React? It's just embedded HTML for me. They never go on to explain why.
And...
Instead, we offer templates as a simpler alternative:
<template> <div class="list-container"> <ul v-if="items.length"> <li v-for="item in items"> {{ item.name }} </li> </ul> <p v-else>No items found.</p> </div> </template>
Notice how the templates are code in strings. I don't find that simpler at all. I find code in strings to be an anti-pattern. I already have a nice real language (TypeScript in my case) to do "templates".
After a while it felt like I was writing strings in strings in strings. And that was exactly was I was doing. I think JSX is a very sane way of coding after all. I think writing things like
<ul>
{childItems.map(x => RenderChild(x)}
</ul>
is wonderfully clear. <ul>
{childItems.map(RenderChild)}
</ul>But when it comes to css, vue's css are way better than React's alternative by a longshot.
The build requirement, and all of the tooling and complexity that is required to make that work.