← Back to context

Comment by hajile

16 days ago

Vue doesn't solve problems better than React (and solves them worse if you have to learn all their proprietary files and DSLs instead of JSX), so there's not much of a reason to switch.

The real discussion would be between React's vdom and something like Solid's signals.

It does, if you care about ergonomics. The reactivity model is simpler and arguably less error prone.

It does have its own templating syntax, which is trivial to learn. No more cumbersome to learn than JSX, which is a templating language designed by the React team. Not sure why you chose to make the distinction between JSX and Vue’s DSL as if JSX wasn’t developed for the sole purpose of facilitating React’s virtual DOM.

  • JSX is <div>abc</div> turns into createElement('div', null, 'abc') and you can use that instead of JSX if you like or you can use something like hyperscript. Everything else like mapping or if statements is pure JS and works just like JS anywhere else in your app.

    Vue templates mean learning Vue's custom syntax for if statements, loops, dynamic attribute syntax (with its own gotcha), binding dot modifiers, data binding, and whatever else. It requires learning its entire custom directive system. It uses custom syntax for stuff like events too.

    I don't see this as remotely comparable with Vue being much closer to something like my time working with Angular 1 (a time I'd rather not repeat).

    • It’s a distinction without a difference. Both need to be transpiled, what happens under the hood is of little concern to anyone.

      Please explain React’s reactive data binding since it’s apparently much simpler than v-model=

      ;)

      4 replies →

  • JSX is a very thin layer of templating logic inside JS. Meaning you have all the language features available while templating. Some arbitrary JS can result in templating.

    Vue's DSL is whatever language the developer implemented. Which is probably not enough, depends how much effort they put into it and how good they are in language design. Given that they cargo cult HTML tags to organize components in a pseudo-familiar but not-valid-HTML way, I don't have much confidence in their language design skills.

    I'd take the former any day.

    • While I understand the advantage of using the built-in language features (and I know why it is required to be done that way), I still think using

          {enable && <Form />}
      

      for conditional rendering, or

          {collection.map(x => <Item x={x} /> }
      

      for looping are not the most obvious choices. If you ask people how conditionals and loops are written in JS, you will get 'if' and 'for' or variants of 'while'. So I get where the v-if and v-for are coming from.

      2 replies →

    • Sorry but JS is, and always has been, a crap language many are trying to escape. So saying react has the full power of JavaScript is an antipatten as far as I am concerned. Vue is better designed.

Vue solve single source of truth much better than react though. The shape of derived data and source data (or even external data) are the same and interchangeable. So you can write an api that works with both without handling implementation quirks at all.

The words borrowed from someone else:

The react is more about view.

The vue is more about reactivity