News for hackers. Stuff that matters.
Re:Guide to JavaScript Frameworks by Kiro on Sunday January 21, 2018 @11:48AM (#16198695)
I've used Vue for larger project and like it but the things you list are the drawbacks IMO:

- Don't need to know jsx!

But you need to learn Vue's template DSL. JSX is just HTML and JavaScript.

- v-for looping is saner than reacts mapping

- v-if allows v-if statements without renderIf component or multiple render statements in react (antipatterns boo!).

Strongly disagree!

- two way data binding with vue-model

I suggest anyone thinking of using two-way binding for anything to rethink their choice. There is always a better way.

Re:Guide to JavaScript Frameworks by dsego on Sunday January 21, 2018 @01:04PM (#16199117)
JSX is NOT just HTML and JavaScript! If it was just html I could write <label for=""> and not <label htmlFor="">, I could write <div class=""> instead of <div className="">. It's not even just javascript, or I would be able to write a simple if-else statement. JSX is a DSL, a minimal one, but still. I mean, you could say it's even worse, because those subtle differences can cost you hours of looking for mistakes.
Re:Guide to JavaScript Frameworks by hobofan on Sunday January 21, 2018 @02:09PM (#16199432)
> If it was just html I could write <label for=""> and not <label htmlFor="">, I could write <div class=""> instead of <div className="">

In case you don't know (and I also didn't until recently), those namings come from the HTML DOM Javascript API, and not from React. So having that naming in React+JSX is more a consequence of operating on that abstraction level, than a quirky decision of the React developers.

Re:Guide to JavaScript Frameworks by dsego on Monday January 22, 2018 @04:16AM (#16203028)
Well, if you're being pedantic, DOM is not HTML.
Re:Guide to JavaScript Frameworks by mlsarecmg on Monday January 22, 2018 @04:34AM (#16203111)
> If it was just html I could write <label for=""> and not <label htmlFor="">, I could write <div class=""> instead of <div className="">

for and class are reserved statements, hence htmlFor and className are the official api names, in other words they belong to the actual web-api spec, there's nothing arbitrary about it:

https://developer.mozilla.org/en-US/docs/Web/API/Element/cla...

https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelEl...

If you really dislike it, you can still use class and for: https://github.com/insin/babel-plugin-react-html-attrs

> or I would be able to write a simple if-else statement

{} evaluates to a ternary. You can use if, according to the spec that's what do expressions are there for.

    do {
        if (condition) <div>yes</div>
        else <h>nope</h>
    }
Though most would probably prefer the following for stylistic reasons:

    condition 
        ? <div>yes</div> 
        : <h>nope</h>
> because those subtle differences can cost you hours of looking for mistakes

These two things are explained in a single sentence, every tutorial eases you into it, the first thing that comes up once JSX is mentioned.

Re:Guide to JavaScript Frameworks by dsego on Friday January 26, 2018 @01:43PM (#16241738)
for and class are not reserved in HTML, they are in JS, but why would that matter for JSX?
Re:Guide to JavaScript Frameworks by mlsarecmg on Monday January 29, 2018 @01:34PM (#16259535)

    const { for, class } = this.props
Will crash. It's just a bit inconvenient (and inconsistent for beginners) having to write:

    const { for: forHtml, class: className } = this.props
Some react-like libs do allow it, but the dom api takes offcial precedence, so it's all fine. It's just that HTML in general was made without taking all the things into account we demand of it today. It wasn't even made for imperative inflating, so the dom-api faced the same troubles.
Re:Guide to JavaScript Frameworks by pitaj on Sunday January 21, 2018 @01:47PM (#16199337)
It is Javascript, but JSX brackets only allow an expression within them. Conditionals are statements in JS, so you have to wrap them in an IIFE or a `do`-expression.
Re:Guide to JavaScript Frameworks by orangecat on Sunday January 21, 2018 @02:10PM (#16199438)
I suggest anyone thinking of using two-way binding for anything to rethink their choice.

v-model isn't two-way binding in the AngularJS sense; it's just a shortcut for binding a "value" property and updating it on "change" events. See https://vuejs.org/v2/guide/forms.html.