4 ms·
Vue supports JSX just fine. It also simplifies many things when compared to React: • lifecycle method names: mounted vs componentDidMount • proptypes: builtin
by mplewis 9y ago
Vue supports JSX just fine. It also simplifies many things when compared to React:
• lifecycle method names: mounted vs componentDidMount
• proptypes: builtin vs `import PropTypes from 'prop-types'`
• component creation: basic JS object vs ES6 class extending `React.component`
Please don't spread misinformation because you prefer one way of writing frontend apps to another. React is better at complex apps, and Vue has a simpler API that many find easier to memorize.
It's rude to insult other commenters by saying "A beginner could blink at this once and start making simple apps blindfolded." I think you're being hyperbolic, but it comes off as condescending.
Frontend is hard. No one "blinks at this once" and learns how to build component-based layouts with view, data, and logic. Please be nice.
- mlsarecmg 9y agoWhy don't you actually recreate the snippet of code up there. The same arguments won't win you a price, and i don't agree with them for all the reasons i've stated. Show me how Vue handles the situation up there in such an easy way please, then we would have something to discuss. > Frontend is hard. No one "blinks at this once" and learns how to build component-based layouts with view, data, and logic. Please be nice. You seem to purposely misunderstand me. I never said someone could learn react by looking at it. I said someone could understand the nature of simple composition by looking at it. I learned Vue fully in maybe a few weeks. React in an hour here: egghead.io/courses/react-fundamentals If you think that studying a 70 page document in order to carry out basics like composition is easy then so be it. If you'd actually dare to post the example in Vue, we'd all see how "easy" the hoops would be you'd have to jump through to realize it.
- overcast 9y agoWhy are you being so confrontational? Seriously. We're discussing web frameworks. This isn't needed on HN, or anywhere. I come here to avoid all the negativity on the web. You enjoy React, we get it. Relax.
- corford 9y ago>Why don't you actually recreate the snippet of code up there. I've never coded in React or Vue but after spending 15 mins reading https://vuejs.org/v2/guide/render-function.html https://vuejs.org/v2/guide/render-function.html here's a pure JS re-creation in Vue for you (fiddle here: https://jsfiddle.net/0wr6xskh/ https://jsfiddle.net/0wr6xskh/): <div id="app"></div> const MyHeader = Vue.component('MyHeader', { render: function (createElement) { return createElement('h1', this.text) }, props: { text: { type: String, required: true } } }); new Vue({ el: '#app', render: function (createElement) { return createElement('div',[ createElement(MyHeader, { props: { text: ''+new Date() } }) ])} }); The above could be expressed more succinctly in JSX (I just can't be bothered reading up on the syntax since, as mentioned, I've never written anything in it and consequently don't know it). More info on Vue's JSX support here: https://vuejs.org/v2/guide/render-function.html#JSX https://vuejs.org/v2/guide/render-function.html#JSX