4 ms·
They mean javascript; jsx is a very small amount of new syntax and is embedded in normal javascript. Learning a completely separate template language with all o
by jonreem 9y ago
They mean javascript; jsx is a very small amount of new syntax and is embedded in normal javascript. Learning a completely separate template language with all of its own constructs for conditionals, iteration, etc. is significantly more work.
- bpicolo 9y agoThere’s not any more to learn vs html than jsx. It’s like 5 relevant constructs that all follow the same form, and the colon. Takes 20 minutes to have it down pat. v-if is actually a big reason I prefer Vue. Ternary operators in JSX are pretty ugly. The other is that Vuex just feels so perfectly integrated. I've never felt Redux blends in particularly cleanly, though I certainly don't judge people that do prefer it.
- rmrfrmrf 9y agoIf `do { }` syntax makes it into ES9, the whole ternary-operator-hate business will be a moot point
- bpicolo 9y agoThat's alright. I love and appreciate React too, I just prefer Vue now.
- dmitriid 9y agoTernary operators in JSX are valid javascript expressions. As is anything that goes into {} All of the following is neither Javascript nor HTML: v-for=”x in list” v-if=”conditional” v-on:click=“function” v-bind:key=“something.id” etc. etc. etc.
- bpicolo 9y agoI'm aware of that bit, I just think they're an ugly piece of control flow inside JSX, and they're also not a particularly versatile piece of control flow. Especially for the else-if case - you end up with repetitive conditionals to replicate that.
- Aeolun 9y ago> and is embedded in normal javascript Exactly! I don't know, but I've always found that disgusting. It turned me off React when I first saw it, and it still does. Then people use it to defend react, and I'm just like 'Lolwut? Did we spend years learning that SOC is a good thing only to throw it out of the window?' I'll be the first to admit that any Vue template quickly becomes soup as well, but at least it's only half of the soup. Is it just younger developers that think React is the best thing since sliced bread?
- dmitriid 9y agoJSX is a thin XML-like DSL on top of Javascript.[1] Unlike untyped strings with a custom parser of Vue, which require you to write something that’s neither HTML nor Javascript. You can have as much separation of concern as you like with React. [1] https://reactjs.org/docs/jsx-in-depth.html https://reactjs.org/docs/jsx-in-depth.html
- nawitus 9y agoJSX is also neither HTML nor JavaScript.
- dmitriid 9y ago> JSX is a thin XML-like DSL on top of Javascript ^ this. It directly translates to `React.createElement`. This is also why everything inside {} is pure Javascript including things like proper `this` etc.
- Can_Not 9y agoOk, so they both let you use something more like what you already know, except neither of them are technically JavaScript or HTML. Glad we established that. I think the understated bikeshed color here is that VueJS allows you to use jade/pug syntax instead of HTML.