Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Just because the click event can take multiple options doesn't mean that it's inconsistent.

That's what inconsistency means. It has multiple v-* attributes and each has different rules on what it accepts.

> ugly code that I've seen in some react projects where the programmer puts a tonne of js code into the templates which as I mentioned before I find an anti-pattern.

JSX isn't templates ;)

> It's a framework, it's supposed to magic away the stupid boilerplate code.

I don't mind magicking away the boilerplate code. I do mind when it's once again so inconsistent in how it magics away that code. For example, in my second link multiple nested properties become properties of `this`, and then:

    // `this.isFolder` magically hoisted into `this` from
    //    `object.computed.isFolder`
    //
    // this.open can be set directly. Magic.
    //    Even though `this.open` magically hoisted 
    //    into `this` from `object.data` which is a function that 
    //    returns an object whose keys and values are hoisted 
    //    into `this`
    //
    // this.model.children cannot be set directly. Not magic
And so on.


Bunch of things going on there:

1 - things defined in data, computed, methods, and props can be accessed on the component directly as a shortcut. This is in the fairly short documentation and everywhere in the code examples. It's not inconsistent if you don't know the rule. It's like complaining that variable names in some languages can start with _ or other special characters but can't start with '1' or start with '2', or start with '3'...

2- and this.model.children definitely can be set directly, and it will be reactive. Unless you're passing an object literal without binding it or if it's not a data object, although I am not 100% sure on this since all my props are usually made reactive by vue and so they are bound. But I know for sure that code like this should work for sure because I've done it.

3 - I don't think that's the correct use of hoisted.

I feel like maybe you'd like vue a lot more if you gave it a chance and went through the documentation (which is pretty good, short and simple). I don't disagree that it has a little bit of magic, but it probably looks worse than it really is if you don't know the rules. Once you know a handful of rules, things are fairly easy to reason about. IMO, easier than angular, and sort of easier than react because there's less code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: