| > it's valid HTML with attributes that tell Vue how to bind to it. It's really not that difficult. 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: <Tag prop=(string or valid Javascript expression)>
other tags, strings, or valid Javascript expressions
</Tag>
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): var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ attrs: { id: "app" } },
[
_c("img", {
attrs: { alt: "Vue logo", src: require("./assets/logo.png") }
}),
_c("HelloWorld", { attrs: { msg: "Welcome to Your Vue.js App" } })
],
1
)
}
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 |
The attributes / DOM properties in JSX are also a mixed bag and not consistent. See https://github.com/facebook/react/issues/13525#issuecomment-...
> 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.
JSX is a custom extension to JavaScript. It's not part of JavaScript or intended to be part of the spec or implemented in browsers. In fact, you have to use some sort of transpiler in order to use it. So, it's not just JavaScript.
> https://pbs.twimg.com/media/DbVEoKOX0AEEen6?format=jpg&name=....
There's really nothing that complicated in here, if you're familiar with Vue. In fact, it's really easy for me to see what's going on at a glance in one place, which is my personal preference. From my own experience, that's rarely the case when working with React the way JSX tends to get broken up because it doesn't have something as simple as a standard if conditional statement within JSX itself.
I've never claimed you do not need to learn anything when working with Vue templates, you need to understand how the system works, but it took me all of a few hours to understand. The features and benefits that I prefer over React/JSX make that worth it to me.