Live data from Hacker News

Vue.js vs. React

vuejs.org

471–480 of 486 posts

Re: Vue.js vs. React

#471
post #40

Earlier quoted context omitted.

This whole "React is complicated" is a strawman. How is JSX more complicated than any template language? How are Vue components any simpler than React components?

In vue you have forma free reactive data without using shouldcomponentupate. Components are updated when data change and only for the data they binding. You have also local context while react have a global context. Props are reactive ... And many others feature

This actually scares me because I have extensive experience in knockoutjs. It also used a reactive system. The problem was once the UI became sufficiently complicated performance would suffer greatly. If you had a lot of computed properties changing a piece of data could result in a lot of UI thrashing as each of these are recomputed. I'm not sure how Vue solves this problem, or even if it does but overall the architecture was inadequate.

Re: Vue.js vs. React

#472
post #244

Earlier quoted context omitted.

> Or when you want to loop through myList, but exclude a few particular items Easy, just create a computed property in Vue.

Yes, that's easy, but adding something to your model just because your view wants it rather seems like the cart driving the horse. If your view needs something that your model otherwise has no use for, then it does not belong in the model.

There's no real clear cut line where you can say that a model had no 'use for' a certain field.

If your point of view is that a model is meant for more than just doing the view, then yes, adding view only fields may pollute it for others (e.g., analytics).

But if your model is meant to drive the view of the app, then the story is very different. And some times you can't even tell if the model is just there to drive the view our not, since requirements change often.

Re: Vue.js vs. React

#473

Earlier quoted context omitted.

What do you have against npm install create-react-app?

Because I'm programming Rails and I don't want another ecosystem polluting the devspace for these projects. (See the unholy mess that is react-on-rails, what with bringing in v8 when Rails already uses another JS engine). I also strongly disagree with node's module culture, and prefer mature environments. The browser loads scripts, why can't that be enough? I see React and Vue as tools for scratching very specific it…

[deleted]

Re: Vue.js vs. React

#474

Earlier quoted context omitted.

Because I'm programming Rails and I don't want another ecosystem polluting the devspace for these projects. (See the unholy mess that is react-on-rails, what with bringing in v8 when Rails already uses another JS engine). I also strongly disagree with node's module culture, and prefer mature environments. The browser loads scripts, why can't that be enough? I see React and Vue as tools for scratching very specific it…

Your year and a half old React app shouldn't be "hopelessly out of date" unless you did something very wrong. If you want to use React with Rails, use Rails in API mode and keep the front-end separate. I'm not sure how rewriting in Vue is going to solve any of your problems at all. "The browser loads scripts, why can't that be enough?" Not sure what you mean by this. Whatever you use, the browser will be loading scri…

From a Rails perspective...

Vue doesn't require nodejs to follow along with the examples

Vue doesn't prescribe to me how I should write my markup (beyond Angular-style attributes) or force me to violate separation-of-concerns.

Vue doesn't require it's stuff to be stored in $ROOT/app/assets/javascript/components, when all the rest of my code lives in $ROOT/app/whatever

Vue doesn't (or didn't) prescribe all these stupid little companion addons to do things I learned how to do (and do better) years ago

Vue doesn't give me a shitty markup language (JSX -- class vs className? Fuck off!) or even worse alternatives (its super verbose JS-DOM alternative) if I don't want (or can't) use it

Vue doesn't have nearly as large of an obnoxious, inexperienced, harebrained, and cloud-huffing crowd that will argue with me when I express distaste in it

Re: Vue.js vs. React

#475

Earlier quoted context omitted.

So let's recap. * You don't know JSX * You have no idea of the specific example posted in this thread that I'm speaking of * You have no idea about WPF and what is a view model But nonetheless you feel entitled to discuss about things in which you have zero knowledge. This is the JSX code posted in this thread: {listOfThings.map(thing => thing.isX ? )} Instead of this monstrosity in XAML would be like this: But of co…

I didn't have to go very far inside ItemsControl to see the example of the "presentation logic" you say doesn't exist. E.g. https://msdn.microsoft.com/en-us/library/system.windows.cont... What is that if not an horribly verbose switch case for modifying the representation of different elements passed to the ItemsControl? I am not advocating that the JSX is particularly pretty or clever. I am objecting to your crazy n…

I asked you to please don't speak about things that you don't know. The page that you linked has nothing to do with presenting multiple items with different types. It is defining the visualisation of the control itself, defining the arrangement method for the contained items, defining the same visualisation for each item and finally it defines the container visualisation for each item. To replicate the JSX logic in the example discussed the code that I posted is all you need. It will bind the source of the ItemsControl to a list in the ViewModel that contains the different ViewModels that you need to display. WPF automatically will find the DataTemplates defined for those ViewModels and use that in the visualisation. No if, no switch, no map and nothing at all in the XAML file. Just:

Re: Vue.js vs. React

#476

Earlier quoted context omitted.

I didn't have to go very far inside ItemsControl to see the example of the "presentation logic" you say doesn't exist. E.g. https://msdn.microsoft.com/en-us/library/system.windows.cont... What is that if not an horribly verbose switch case for modifying the representation of different elements passed to the ItemsControl? I am not advocating that the JSX is particularly pretty or clever. I am objecting to your crazy n…

I asked you to please don't speak about things that you don't know. The page that you linked has nothing to do with presenting multiple items with different types. It is defining the visualisation of the control itself, defining the arrangement method for the contained items, defining the same visualisation for each item and finally it defines the container visualisation for each item. To replicate the JSX logic in t…

I think you are comparing Apple with oranges here. React doesn't have a ViewModel notion that would binds data with Component. The binding is happening in the templates themselves so in the Component themselves and there is no in-between layer AFAIK.

If you are looking for exactly this feature you might be disappointed.

Re: Vue.js vs. React

#477
post #108

I've built semi-large applications in both Vue.js and React. I like both but prefer React. For me Vue.js is like a light-weight Angular 1, in a good way. It's very intuitive and you can start working immediately. It does however easily end up in confusion about where the state lives with the two-way binding. I've run into a lot of implicit state changes wrecking havoc. The declarative nature of React definitely wins…

I love single file components. I used Polymer before React and that is the thing I miss the most. I've also been using CSS-in-JS for the same reason. I landed on JSS for now, but I'm hoping we'll see a solid scoped CSS solution soon.

I've been very impressed with styled-components - it's outstanding. Inline, scoped, fully native CSS.

If you're using vscode add plugin "Template literal editor" and you get full intellisense on the CSS too!

Re: Vue.js vs. React

#478

Earlier quoted context omitted.

I asked you to please don't speak about things that you don't know. The page that you linked has nothing to do with presenting multiple items with different types. It is defining the visualisation of the control itself, defining the arrangement method for the contained items, defining the same visualisation for each item and finally it defines the container visualisation for each item. To replicate the JSX logic in t…

I think you are comparing Apple with oranges here. React doesn't have a ViewModel notion that would binds data with Component. The binding is happening in the templates themselves so in the Component themselves and there is no in-between layer AFAIK. If you are looking for exactly this feature you might be disappointed.

Vue.js and Angular have the ViewModel concept.

Re: Vue.js vs. React

#479

Earlier quoted context omitted.

> So for you using a map with a ternary operator over a list of objects in JSX is perfectly fine and you can't see what is wrong I don't really know JSX much and without a specific example this is pointless to discuss. But basically JSX is syntactic sugar over javascript. A ternary is just a "if" condition so I don't see where is the issue here. Are you really using a template language devoid of conditionals? Even mu…

So let's recap. * You don't know JSX * You have no idea of the specific example posted in this thread that I'm speaking of * You have no idea about WPF and what is a view model But nonetheless you feel entitled to discuss about things in which you have zero knowledge. This is the JSX code posted in this thread: {listOfThings.map(thing => thing.isX ? )} Instead of this monstrosity in XAML would be like this: But of co…

No, but he knows that templating languages have been wrestling with pretty much the same three or four issues since the beginning of HTML templates. It gets old.

It gets really old to see people try failed experiments over and over again, which pretty much is what you are suggesting.

Also, you got some display logic in your examples there, buddy. If you can't see it then no wonder this conversation is going in a circle.

Re: Vue.js vs. React

#480

Earlier quoted context omitted.

Your year and a half old React app shouldn't be "hopelessly out of date" unless you did something very wrong. If you want to use React with Rails, use Rails in API mode and keep the front-end separate. I'm not sure how rewriting in Vue is going to solve any of your problems at all. "The browser loads scripts, why can't that be enough?" Not sure what you mean by this. Whatever you use, the browser will be loading scri…

From a Rails perspective... Vue doesn't require nodejs to follow along with the examples Vue doesn't prescribe to me how I should write my markup (beyond Angular-style attributes) or force me to violate separation-of-concerns. Vue doesn't require it's stuff to be stored in $ROOT/app/assets/javascript/components, when all the rest of my code lives in $ROOT/app/whatever Vue doesn't (or didn't) prescribe all these stupi…

Yikes
Post reply on HN