Live data from Hacker News

Vue.js vs. React

vuejs.org

101–110 of 486 posts

Re: Vue.js vs. React

#101

Earlier quoted context omitted.

JSX is closer to JS than HTML, which means it annoying to write in some cases. Quick, what does this render as? Link 1 | Link 2 | Link 3 It's not Link 1 | Link 2 | Link 3 as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace. Here's another - { Object.entries(definitions).map(([…

Good point about the whitespace, but I'd still rather have the templates inside my code than separate the two, mentally parsing two separate languages with different syntax and stitching them together is a lot more mental overhead IMO.

It's a matter of personal opinion, but I guess I'm more used to server-side templating languages, which Vue's looks much more similar to. I have the same problem as you for JSX - I keep trying to read it as HTML, except it's not, and mentally translating it is annoying.

Re: Vue.js vs. React

#102

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.

JSX is closer to JS than HTML, which means it annoying to write in some cases. Quick, what does this render as? Link 1 | Link 2 | Link 3 It's not Link 1 | Link 2 | Link 3 as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace. Here's another - { Object.entries(definitions).map(([…

If you want whitespace, the proper thing to do is to use   HTML entity.

Re: Vue.js vs. React

#103
post #96

Earlier quoted context omitted.

Ultimately this was a client project with a fixed budget and timeline so a decision had to be made between extending browser support and adding more features. Given the target audience (graphic designers, the vast majority of whom are on Mac and will use Safari or Chrome, as I validated from stats on other sites I've built), the decision was made to focus work on the type tester on those browsers. The rest of the sit…

> Anyway, hopefully that justifies it somewhat - I think it was the right decision all things factored in. There's a lot of CSS trickery/hackery to make the type tester work (native support for advanced typography stuff is poor) so making it x-browser wasn't easy. The messaging to users of other browsers could probably be improved though :) It doesn’t even work on Chromium, in the same version as Chrome. There is lit…

Good point about Chromium, I'll change that - it wasn't deliberately excluded. But disagree about the messaging, in this case it was more important to the client that the feature worked as smoothly as possible than that everyone could see it. In some cases I'd disagree, but given the narrow target demographic (and their browser choices) here, I think it was a reasonable choice.

Re: Vue.js vs. React

#104
Another option that is interesting right now is Polymer 2.x if you haven't tried it recently, give it a shot.

https://vuejs.org/v2/guide/comparison.html#Polymer There are some similarities shared between polymer and react/vue (personally only used react and angular 1.x before).

I've built applications with it using polyfills and things worked just fine with legacy applications on IE10 + jquery interacting with web components.

Performance is nice, there is more and more adoption from giant enterprises like Netflix, IBM, GE, Gannett, Electronics Arts, CocaCola, ING, BBVA.

Webcomponents.org has over 1k components to choose from and is growing.

Now with `lit-html` arriving soon we might see alternative to JSX if someone wants that, polymer-redux or polymer-uniflow is available as an option too.

https://hnpwa.com/ - one of fastest Hacker News implementations is based on Polymer - and that is even without SSR.

SvelteJS also seems nice, although it seems one-man project for now :( On Polymer end I hope that on the summit next week they will announce proper NPM support finally and I miss that.

Re: Vue.js vs. React

#105
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.

Sorry but that's not true. We have a pretty heavy VueJS application in production with like 500 components and it's a pleasure to work with, and is still quite performant.

Re: Vue.js vs. React

#106

So Vue is based on the same Virtual DOM as Elm, or its own implementation? Do non-react tools in this arena still have react-like lifecycle hooks, or different ways of handling "on mount" behavior, for example?

I'm not very familiar with React, but Vue does have lifecycle hooks that work well: https://vuejs.org/v2/guide/instance.html#Instance-Lifecycle-...

Re: Vue.js vs. React

#107

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.

JSX is closer to JS than HTML, which means it annoying to write in some cases. Quick, what does this render as? Link 1 | Link 2 | Link 3 It's not Link 1 | Link 2 | Link 3 as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace. Here's another - { Object.entries(definitions).map(([…

I disagree on your first example: I've historically found the extra whitespace a huge PITA for years. It causes extra "unpredictable" spacing in your design which is usually unwanted. It's only an issue for multi-line prose. React is opinionated here but I've found it's the most useful option.

On the 2nd point, you are partially correct. In general it's a code smell - strongly consider making it a component (in part for optimization). But definition lists are specifically strange: Unlike other repeating elements in HTML they don't have a container element like tr, li, fieldset, etc.

Re: Vue.js vs. React

#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 here, especially working with stateless functional components. If you're serious about Vue you should adhere to unidirectional bindings, components and use Vuex.

The best thing about Vue.js for me is the single file components. It's such a nice feeling to know that everything affecting a certain component is right before your eyes. That's also the reason I started adapting CSS-in-JS in my React components.

The biggest problem for me with Vue.js is the template DSL. You often think "how do I do this complicated tree render in Vue's template syntax? In JSX I would just use JavaScript". For me, that was the best upgrade going from Angular to React and it feels like a step backwards when using Vue.js.

Re: Vue.js vs. React

#109

Earlier quoted context omitted.

This is the impression I get, but I've not got any Vue experience to back it up so it's literally just based on first impressions. I completely agree that React can feel like overkill for simple stuff, but really shines as the apps get more complex - complexity feels a lot more manageable. For example, I built this in-browser Illustrator-inspired site/app using React and couldn't have imagined doing it without (in te…

> please visit this site using some recent version of [browser that sends all your data to Google] slowclap If using a JS framework means you don't have time to test your website in more than one browser, I'll happily continue writing plain JS (or better yet, no JS).

False dichotomy. OP could have tested for FF if he wanted to, irrespective of the framework he has chosen.

Personally, I develop Firefox-first and then work on compatibility for lesser browsers like Chrome and Safari.

Of course things have been complicated a bit now that Firefox Focus is out and uses Webkit...

Re: Vue.js vs. React

#110
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…

I don't think one should base the decision what to choose solely on "who gets more downloads".

Otherwise we would all be still using PHP instead of Python or Ruby.

Post reply on HN