Live data from Hacker News

How we do Vue: one year later (2017)

about.gitlab.com

151–159 of 159 posts

Re: How we do Vue: one year later (2017)

#151
post #144
post #76

Earlier quoted context omitted.

I regret every line of Redux boilerplate I ever wrote before discovering MobX. MobX is now even more fantastic with the new proxy based implementation. Reading up on VueX.. Not really looking forward to having to use it over MobX.

> MobX is now even more fantastic with the new proxy based implementation. What does this mean? I've used MobX in the past but curious what has changed with this.

I'm wondering if it's this: https://davidwalsh.name/javascript-proxy

Re: How we do Vue: one year later (2017)

#152

Earlier quoted context omitted.

> rather than JSX's more sensible curly brackets I'm still waiting for the 2019 equivalent of http://haml.info/

How about Hiccup? Some examples here: https://reagent-project.github.io/ It's not haml, but I'd argue it's awesome.

Thanks. Seems nifty but ClojureScript is a bit too foreign for me

Re: How we do Vue: one year later (2017)

#153
post #10
post #4

> Just use VueX That's the problem with large-scale Vue apps. Vue is awesome until you need to use VueX, after which it just becomes an inferior version of React + Redux.

Inferior? How exactly? I found Redux to be highly over-engineered in contrast to Vuex which is a lot like MobX - easy to use, yet powerful.

I like the idea that the 200 line event dispatching state atom is more over-engineered than a framework that works off wrapped "observable" objects and uses ES6 proxy magic (MobX). Do proxies work in IE11? Didn't think you could just polyfill them.

Re: How we do Vue: one year later (2017)

#155

Earlier quoted context omitted.

I have the opposite feeling to you. The template feels like HTML to me and the syntax is clear and concise. React for me gets confusing with it all muddled together. But each to their own.

Compared to React (and React’s JSX) Vue’s syntax is orders of magnitude more complex and is very inconsistent: https://news.ycombinator.com/item?id=19199423

That's a very strong statement. To me the templating part of Vue is the least of my problems. While in theory you could make it sound complex by listing an exhaustive list of custom attributes, in reality this is almost never a problem. I have 2+ years experience in Vue, and I've never had any issues with the templating. Problems that are orders of magnitude more complex than templating are problems related to component lifecycles, functional composition, higher-order components, application architecture, server-side rendering + hydration, etc. None of this is solved by using JSX or some other templating language and these kind of problems exist regardless choosing Vue/React.

I feel like these kind of arguments are usually made by people who don't have any extensive experience using Vue, because in practice, it's not really a problem. Sure, you may not like it and prefer JSX (I understand all the pros and cons, all very valid), but that's a whole different statement than saying "Vue's syntax is orders of magnitude more complex and very inconsistent". That's just plain wrong.

Re: How we do Vue: one year later (2017)

#156

Earlier quoted context omitted.

If you mix server-side rendered apps with Vue, this is the most common way. Second method is to push the data to a window.__data.staffMemberOptions = "{{ foo }}" and use it in Vue.

Thanks, good to hear. Elsewhere I've added something similar, and populate the data this way: var vue = new Vue({ el: '#app', created: function () { for (var key in __app.dataForVue) { this[key] = __app.dataForVue[key]; } }, // ... };

Or as another approach:

    
    
    

    // main.js
    new Vue({
        template: '',
        components: {App},

        data() {
            return {
                inventory: null
            }
        },
    
        beforeMount: function () {
            this.inventory = JSON.parse(this.$el.attributes['data-inventory'].value);
        }
    }).$mount('#app');

Re: How we do Vue: one year later (2017)

#157
post #155

Earlier quoted context omitted.

Compared to React (and React’s JSX) Vue’s syntax is orders of magnitude more complex and is very inconsistent: https://news.ycombinator.com/item?id=19199423

That's a very strong statement. To me the templating part of Vue is the least of my problems. While in theory you could make it sound complex by listing an exhaustive list of custom attributes, in reality this is almost never a problem. I have 2+ years experience in Vue, and I've never had any issues with the templating. Problems that are orders of magnitude more complex than templating are problems related to compon…

> a whole different statement than saying "Vue's syntax is orders of magnitude more complex and very inconsistent". That's just plain wrong.

There is an easy test to see if my statement was true or false:

    
where "attr" is a Vue attribute. What is x and what can x be? An expression? A string? A function reference? An object? How will it be processed and presented in the end? As a string? As a function call?

At any given point in time the value in an attribute is entirely dependent on context (which particular Vue attribute it's in) and on a very arbitrarily defined rules for those attributes. For example, v-on accepts three absolutely different and incompatible things:

   v-on:click="x + 1" 
       A Javascript expression
   
   v-on:click="function_ref" 
       A function reference bound to JS-code

   v-on:click="function_call(param1, param2)" 
       Looks like a function call but isn't. It's a way to
       declare a function ref that will be called with bound params
And that's just one of the tags! I'm not even touching on the JS side of things where magic is abound (see comments at the end here: https://news.ycombinator.com/item?id=17471199)

Compare to React's JSX:

     // x is a string
     // x is a valid Javascript expression
These are the same and they are consistent for every single attribute. The only limitations come from the meaning and the usage of the attributes themselves.

    
     regular_JS_arrow_function() }}>
       onClick expects a function reference because that's
       what it will eventually call
And the rest around JSX? Plain old Javascript. Where this:

    {
      data: function () {
        return {
          open: false
        }
      }
    }
doesn't magically turn into this in a completely different part of the object:

    {
      methods: {
        toggle: function () {
            this.open = !this.open
        }
    }

Re: How we do Vue: one year later (2017)

#158

Earlier quoted context omitted.

I'm too inexperienced to have a definitive opinion, but I'm not nearly so positive and wanted to toss out a contrasting opinion to the current comments. After a few years of using React and some past experience with various other templating/view systems (webdev of one sort or another since '99) I started picking up a little Vue. So far it's been easy enough, but it is highly confusing compared to most other systems I…

I have the opposite feeling to you. The template feels like HTML to me and the syntax is clear and concise. React for me gets confusing with it all muddled together. But each to their own.

I doubt we'll agree, but something as simple as: make an unordered list of hrefs with a url (based on name) and the name. Also, have a class on the currently selected (currently selected meaning some variable matches the item name in the list) ends up with several special attributes, and a scope question (will a bound class see the iteration variable?) - all of which is not a question in something like React because there's not special scope being created, the same rules I'm used to always apply.

Different strokes for different folks, but I was quite surprised at my experience. Everyone keeps using the word "intuitive", and anything that I have to learn all these rules and special cases for is the opposite.

Re: How we do Vue: one year later (2017)

#159
post #121

I've been working with Vue for a few months now, after several years with React, angular, JSP, rails and django (and of course jquery). I know a lot of people, especially in HN, are impressed by it but I found it very lacking. It makes things easy to write at first and with very little learning curve but trades that ease of use for stability, simplicity and maintainability. The main problems, to me, are: * too much g…

I've also been using Vue for a couple of months now. Initial experience is fairly positive, but there are absolutely things I miss. I don't miss JSX that much, but I really miss the way Angular let me inject services wherever I need, and views get updated automatically. If I try anything like that in Vue, it doesn't work, I need to put everything in the Vuex store, which makes the store a single global variable that…

Tell me, what's the difference of simply importing a JavaScript file with your service code compared to injecting the service with DI in Angular? At the end of the day, Vue is just a UI library. From here you can build your application architecture the way you like. So the difference to Angular is, that Angular is a complete framework which tells you how to define services the Angular way. In React and Vue, you just do that how you would do it in vanilla JavaScript.
Post reply on HN