Live data from Hacker News

Why we chose Vue.js over React

pixeljets.com

251–260 of 267 posts

Re: Why we chose Vue.js over React

#251
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

> and sound like "we couldn't figure out how to make it work for us so it must be impossible". It sounded more just like "we couldn't figure out how to make it work for us", which is a perfectly plausible position. The author just stated that React didn't work for them, not that it's "impossible to use React" as you are implying. From the article: > I guess this level of strictness and purity is something that may be…

[deleted]

Re: Why we chose Vue.js over React

#252
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

> and sound like "we couldn't figure out how to make it work for us so it must be impossible". It sounded more just like "we couldn't figure out how to make it work for us", which is a perfectly plausible position. The author just stated that React didn't work for them, not that it's "impossible to use React" as you are implying. From the article: > I guess this level of strictness and purity is something that may be…

Fair enough, but if they're going to write about their opinions and argue that "JSX sucks", they should at least be intimately familiar with it. Choosing lack of conditionals as the issue to focus on instead of any other problems templating in React has tells me that they're not.

Re: Why we chose Vue.js over React

#253

"I expect Vue to become a primary JS framework in 16-24 months if Evan You makes right steps, at least around backenders and smaller teams of frontenders." When Vue.js gets a big enough community passionate enough to host their own conference, we'll be able to consider this as a possibility. :)

Ha, well just wait for 2017

Re: Why we chose Vue.js over React

#254
post #39

I wonder why people need Redux, Using simply React is great and enough if you understand it well

No it's not. You can't communicate cross components with just react, you're stuck on a parent-child relationship.

you can by passing right state to the closest common parent. I pass props down, and a custom update function, easy, efficient (with PureComponents)

Re: Why we chose Vue.js over React

#255
post #39

I wonder why people need Redux, Using simply React is great and enough if you understand it well

React is just the UI piece of the puzzle. Here's a nice description of when to use Redux: "[Redux is justified when] you have a piece of data that needs to be used in multiple places in your app, and passing it via props makes your components break the single-responsibility principle (i.e. makes their interface make less sense)" ( https://github.com/petehunt/react-howto/issues/12#issuecomme... ) This comment was writ…

Yea I know what Flux, Redux are, and honestly I think they are completely not needed if you understand and use React well, see comment below

Re: Why we chose Vue.js over React

#256
post #182
post #98

Earlier quoted context omitted.

I think your comment just proves the point of the original post. Your examples are still not good enough for me in terms of syntax and real work with html guys (specifically, has some quirks). I've gone through these things, and the pain&negativity about Angular 1 which translates to negativity to all template engines was also mentioned in the post.

JSX is awesome. It's just JavaScript, you can do whatever you want... return ( { selected ? : null } ); or let children = []; if (selected) children.push( ); if (blah) children.push( ); return ( { children } ); or const bar = selected ? : null; return ( { bar } );

Our Perl5 CGI.pm codebase used to look like that (html + logic). Fortunately we switched it over to Mojolicious and it became manageable. Not going back there thank you.

Re: Why we chose Vue.js over React

#257

Earlier quoted context omitted.

Wow. Do people consider this kind of coding acceptable now? We spent decades trying to separate templates, business logic, and inlined JS, and you managed to cram all three into a short snippet.

Whether to show a logout link or a login form is presentation logic, not business logic. I've spent decades telling people that trying to keep logic out of templates is a waste of time. A useful templating language has variables, conditionals, and even functions. There's no reason not to use a real programming language. There's no good automated way to enforce MVC. How is an automated tool going to know whether "show…

>> Whether to show a logout link or a login form is presentation logic, not business logic.

I would prefer keeping presentation logic, or any logic for that matter, out of the HTML.

Re: Why we chose Vue.js over React

#258
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

For the first example, if you're willing to risk a stage-0 transform, you could try using a shiny do expression:

  render() {
    return 
      {do {
        if (loggedIn) { Logout; } 
        else { ; }
      }}
    
  }

Re: Why we chose Vue.js over React

#259

Earlier quoted context omitted.

When I see examples like this, it reminds me just how elegant & simple Mustache.js template can be: Mustache.render( "{{#loggedIn}}Hello{{userName}}{/loggedIn}} {{^loggedIn}}Please log in{{/loggedIn}}", state );

What exactly is elegant and simple about that? I feel like this kind of syntax would break down on more complex examples, is that not the case? What would it look like with multiple conditions (say something like A && B || C)?

What on earth does not break given more complex examples? That's a bit of a non-argument. The mustache example is a direct translation of the jsx example, so keep things in context. As for your multiple conditions question, what exactly is the point of that? All l see is code, no data, no markup. Completely irrelevant.

Re: Why we chose Vue.js over React

#260
post #241

Earlier quoted context omitted.

When I see examples like this, it reminds me just how elegant & simple Mustache.js template can be: Mustache.render( "{{#loggedIn}}Hello{{userName}}{/loggedIn}} {{^loggedIn}}Please log in{{/loggedIn}}", state );

Elegant & simple?

Elegant & simple!
Post reply on HN