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…
Why we chose Vue.js over React
251–260 of 267 posts
Re: Why we chose Vue.js over React
#252The 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…
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. :)
Re: Why we chose Vue.js over React
#254I 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.
Re: Why we chose Vue.js over React
#255I 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…
Re: Why we chose Vue.js over React
#256Earlier 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 } );
Re: Why we chose Vue.js over React
#257Earlier 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…
I would prefer keeping presentation logic, or any logic for that matter, out of the HTML.
Re: Why we chose Vue.js over React
#258The 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()…
render() {
return
{do {
if (loggedIn) { Logout; }
else { ; }
}}
}Re: Why we chose Vue.js over React
#259Earlier 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)?