| > I go a bit in depth here: https://news.ycombinator.com/item?id=17471199 I've read this before. Vue is a framework. It also has a templating system that is not JavaScript, it's valid HTML with attributes that tell Vue how to bind to it. It's really not that difficult. > Vue's templates are not HTML-compliant. They are just that: templates. That get compiled to JS anyway. Sorry, but you're wrong here. They are valid HTML. https://vuejs.org/v2/guide/syntax.html "Vue.js uses an HTML-based template syntax that allows you to declaratively bind the rendered DOM to the underlying Vue instance’s data. All Vue.js templates are valid HTML that can be parsed by spec-compliant browsers and HTML parsers." > JSX is a very thin DSL on top of Javascript. It's just function calls: https://reactjs.org/docs/react-without-jsx.html IMHO only the simplest of components featuring JSX that don't read like a spaghetti PHP coding nightmare to me. For the small number of times you actually need the full power of JavaScript you could also use JSX in Vue with a render function if necessary. I personally prefer to keep my templates and logic separate when possible. > It's not a webpack add-on. It's a part of Vue's templating engine that is essentially CSS-in-JS, they just give you a template to work in. No, it's not part of the template engine, it's part of vue-loader which is used by Webpack to create single file components. https://github.com/vuejs/vue-loader |
You mean it has at least three JS-like DSLs (which are not JS, and have different rules depending on which context they are in). In addition it has a very weird binding system which I described at length in the linked comment.
Yup. "Not that difficult".
Meanwhile JSX is a single consistent DSL that directly maps to function calls:
That's it. Even "html-like" attributes that people seem to not like... are exactly what HTML attributes are in actual Javascript DOM APIs [1] [2]The amount of custom attributes, custom DSLs and gotchas just in the "HTML" part of Vue is staggering in comparison: https://pbs.twimg.com/media/DbVEoKOX0AEEen6?format=jpg&name=...
And funnily enough it ends up being compiled to what React is in the first place (here's the output of a Hello World app in Vue):
Look, it's exactly what React without JSX is [3]. Only in React you don't need to invent a custom scripting language and binding rules.[1] https://developer.mozilla.org/en-US/docs/Web/API/Element/att...
[2] And I'm really sad to see React team seriously discuss caving in to mob and considering replacing className with class etc.
[3] https://reactjs.org/docs/react-without-jsx.html