Live data from Hacker News

Vue.js vs. React

vuejs.org

201–210 of 486 posts

Re: Vue.js vs. React

#201
post #128

Earlier quoted context omitted.

or introduce new and weird concepts to replace things that are easy, familiar and often better designed in the host language. Oddly, that's exactly how I feel about the "{condition_expression && template_evaluation}" idiom in JSX.

Personally I prefer the ternary operator in those cases, however I think do expressions will fix most of the if/else awkward stuff: https://babeljs.io/docs/plugins/transform-do-expressions/

Can that actually help react look better here? I'm currently imagining:

  { do {
    if (condition_expression) {
      template_evaluation
    }
  }}

Re: Vue.js vs. React

#202
post #164

I experimented a little bit with Vue. I was a little bit disappointed about two points: 1. I couldn't CSS style a Vue component. I find components very important and they should behave like HTML elements. It should be possible to write a element in Vue if that element didn't exist. 2. I find the state management Vuex somewhat an afterthought. Some people say you will know when you need state management, but I think i…

One of the biggest selling points for single file components is styling (with optional scoping): https://vue-loader.vuejs.org/en/features/scoped-css.html If you need to override child component styles from a parent (bad idea in 99.999% of cases), /deep/ would work.

Vue components are second class citizens compared to HTML elements, because you don't style them, you pass them props.

This idea with stylable components is for a different framework, perhaps.

Re: Vue.js vs. React

#203
post #191
post #179

Earlier quoted context omitted.

> It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading What does this mean? I have a sneaking suspicion this is a symptom of poor separation of concerns.

It means that you can't loop where you actually need that loop and that makes reading and writing markup harder than it needs to be. https://facebook.github.io/react/docs/lists-and-keys.html Since JSX mixes logic and markup indistinguishably I'd say that's where the poor separation of concerns really is.

I'm not sure I follow. To use the basic example from the link, as opposed to this:

  const listItems = numbers.map((number) =>
    {number}
  );
  return (
    {listItems}
  );
What's wrong with looping this way?:

  return (
    
      {numbers.map((num, i) => {num})}
    
  )

Re: Vue.js vs. React

#204
post #132

We moved away from React to Vue about 8 months ago and everyone on the team is a lot happier. First reason is we hate JSX. It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. It's like writing shitty PHP code without templates. It also forces you to use a lot of boilerplate like bind(), Object.keys(), etc. Another problem with React is that it only really solves o…

> It's like writing shitty PHP code without templates. For me, it's the other way around. I feel like you can still separate the logic and markup, but instead of the template engine syntax you can just JavaScript. From the top of my head, I can at least remember six template engines' syntax I've learned: Smarty (PHP), Mustache, Blade (PHP), EJS, Angular and another custom template engine. When I tried React I was so…

You can use JSX with Vue, and still get its other benefits. :)

Re: Vue.js vs. React

#205
post #132

We moved away from React to Vue about 8 months ago and everyone on the team is a lot happier. First reason is we hate JSX. It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. It's like writing shitty PHP code without templates. It also forces you to use a lot of boilerplate like bind(), Object.keys(), etc. Another problem with React is that it only really solves o…

Jsx is one of the best parts of react. No way I can go back string templates and it's own languages.

Re: Vue.js vs. React

#206
post #132

We moved away from React to Vue about 8 months ago and everyone on the team is a lot happier. First reason is we hate JSX. It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. It's like writing shitty PHP code without templates. It also forces you to use a lot of boilerplate like bind(), Object.keys(), etc. Another problem with React is that it only really solves o…

Hm? You can actually write loops and conditionals inside of the markup. And... why would you strictly want to do that?, you can write cleaner code by separating your logic/UI. This look more like a rant overall.

Re: Vue.js vs. React

#207

What's with the hate for JSX? I think handling HTML as data makes much more sense and is much more convenient than dealing with dumb templates or weird DSLs like Vue's or Angular's.

Surely the huge win for JSX is that you can type check it? I have a Typescript + Angular 1 project. The app logic feels robust as Typescript makes sure I'm using the right identifiers, variables aren't null/undefined etc. The Angular templates are a constant source of annoyance: they aren't type checked and aren't part of automatic variable renaming refactorings.

Wow that is a good point! I have the same experience with Angular.js 1 and TypeScript.

Can someone confirm that you cannot type check Vue.js templates (without using Vue.js JSX support of course)?

Re: Vue.js vs. React

#208
post #11

Vue is good for simple things. But it do not shines for complex apps and sometime makes it even harder than it should be. React can appears complicated when beginning, but it pays off on complex apps.

i'd say it's quite the opposite. vue makes complex apps easy to write, where react makes it look complex all the time.

Re: Vue.js vs. React

#209
post #57
post #46

You'll see quotes in this thread like "The demand for both React and Vue.js is growing tremendously" thrown around. It's good to check out npm install stats to get an unopinionated comparison. https://npm-stat.com/charts.html?package=react&package=vue&p... In reality, React is downloaded roughly 4-5x more than angular and 7-8x more than Vue. In August so far, React has 75% market share among these three libs. Interes…

Something worth noting is that both Angular and Vue are far more script-embed-directly-into-page friendly (mostly due to templating) compared to React. Almost all React users get it from NPM, while I would expect that the proportion of Angular or Vue users who get them from NPM is lower. I've seen a lot of projects for those two run without any build system (and anecdotally, I'm pretty sure I'm not the only one who's…

Perfectly said. I've used Vue for a couple of months now (a couple personal projects, experiments and some dashboards) and used Angular for ~2 years before (admittedly, mostly Angular 1), and have literally never had to start off from 'npm install', unlike react (which I used for a year or so before), where everything needed a lot of boilerplate setup.

Most devs I know start a react application by cloning some standard git repo which has a working webpack/tidyCSS/redux/some test suite etc. and then write your first line of useful code. The boilerplate is enormous!

Re: Vue.js vs. React

#210
post #132

We moved away from React to Vue about 8 months ago and everyone on the team is a lot happier. First reason is we hate JSX. It forces you to write loops, conditionals, etc, outside of the markup you are currently writing/reading. It's like writing shitty PHP code without templates. It also forces you to use a lot of boilerplate like bind(), Object.keys(), etc. Another problem with React is that it only really solves o…

I feel like JSX is the biggest failed promise of React. It's supposed to make the behavior of views transparent by building markup in plain JS. But what actually happens is you have to write noisy JavaScript that obfuscates your markup.

Just look at any component that dynamically generates CSS classes. Template strings with ternaries? Another dependency for generating nice CSS class strings? Give me a break.

JSX falters because JS is not terse enough. You end up with templates that have neither readable logic nor readable markup. And naturally, programmers being as lazy as they are, these templates become a holding bag for -every- concern.

Post reply on HN