Earlier quoted context omitted.
Wow. Do people consider this kind of coding acceptable now? We spent decades trying to separate templates, business logic, and inlined JS, and you managed to cram all three into a short snippet.
It's actually no different to any other templating solution. Take a look at this[1] Mustache.js example and note the logic! At least JSX is honest about what it is. [1]: https://news.ycombinator.com/item?id=13153298
Why we chose Vue.js over React
261–267 of 267 posts
Re: Why we chose Vue.js over React
#262Earlier quoted context omitted.
Wow. Do people consider this kind of coding acceptable now? We spent decades trying to separate templates, business logic, and inlined JS, and you managed to cram all three into a short snippet.
It's actually no different to any other templating solution. Take a look at this[1] Mustache.js example and note the logic! At least JSX is honest about what it is. [1]: https://news.ycombinator.com/item?id=13153298
Re: Why we chose Vue.js over React
#263With all the evangelism I've seen on HN about React, I have yet to see a cohesive post about the benefits that it provides that makes it worth the investment in learning. Nor have I seen a seen a good review of tooling that provides a good path for someone who wants to try it out. What I do see, are arguments that "it can do that too if you only knew how to use it!" That and a lot of sample code that embeds html with…
Re: Why we chose Vue.js over React
#264Earlier quoted context omitted.
What exactly is elegant and simple about that? I feel like this kind of syntax would break down on more complex examples, is that not the case? What would it look like with multiple conditions (say something like A && B || C)?
What on earth does not break given more complex examples? That's a bit of a non-argument. The mustache example is a direct translation of the jsx example, so keep things in context. As for your multiple conditions question, what exactly is the point of that? All l see is code, no data, no markup. Completely irrelevant.
After all, we're not just displaying "Hello" or "Please log in" all day.
Re: Why we chose Vue.js over React
#265Earlier quoted context omitted.
What on earth does not break given more complex examples? That's a bit of a non-argument. The mustache example is a direct translation of the jsx example, so keep things in context. As for your multiple conditions question, what exactly is the point of that? All l see is code, no data, no markup. Completely irrelevant.
No need to get so defensive. I'm just curious how it holds up in more complex examples. I know how JSX does because you just use the same concepts you already know from JS. But Mustache seems to have its own custom syntax, so how well can it express more complex cases? After all, we're not just displaying "Hello" or "Please log in" all day.
To answer you question, you use JS! Or PHP! Or any of the other 2 dozen languages Mustache supports. Mustache is all about logic-less templates, which by definition assumes the logic is being written elsewhere. Edited my example to make that clearer.
EDIT:
const tpl = "{{#loggedIn}}Hello{{userName}}{/loggedIn}}{{^loggedIn}}Please log in{{/loggedIn}}";
Mustache.render( tpl, state );Re: Why we chose Vue.js over React
#266Earlier quoted context omitted.
No need to get so defensive. I'm just curious how it holds up in more complex examples. I know how JSX does because you just use the same concepts you already know from JS. But Mustache seems to have its own custom syntax, so how well can it express more complex cases? After all, we're not just displaying "Hello" or "Please log in" all day.
I simply responded in kind. Notice the difference in tone from your first response, and this one. To answer you question, you use JS! Or PHP! Or any of the other 2 dozen languages Mustache supports. Mustache is all about logic-less templates, which by definition assumes the logic is being written elsewhere. Edited my example to make that clearer. EDIT: const tpl = "{{#loggedIn}}Hello{{userName}}{/loggedIn}}{{^loggedI…
Re: Why we chose Vue.js over React
#267Earlier quoted context omitted.
I simply responded in kind. Notice the difference in tone from your first response, and this one. To answer you question, you use JS! Or PHP! Or any of the other 2 dozen languages Mustache supports. Mustache is all about logic-less templates, which by definition assumes the logic is being written elsewhere. Edited my example to make that clearer. EDIT: const tpl = "{{#loggedIn}}Hello{{userName}}{/loggedIn}}{{^loggedI…
Hmm, I see what you mean about pushing logic to the code calling Mustache, but I still wouldn't call it elegant with all the curly braces and explicit closing tags needed. JSX isn't elegant either in that regard which is why I work with React through ClojureScript.
There is even a ClojureScript implementation: https://github.com/fotoetienne/cljstache
Yes mustache, JSX and all the other templating syntax aren't pretty, but my point was that Mustache is the best I've come across so far. elegance and simplicity are in the eyes of the beholder though, so to each their own.