News for hackers. Stuff that matters.
Re:Vue.js vs. React by al2o3cr on Saturday August 19, 2017 @11:38AM (#15053959)

    or introduce new and weird concepts to replace things that
    are easy, familiar and often better designed in the host
    language.
Oddly, that's exactly how I feel about the "{condition_expression && template_evaluation}" idiom in JSX.
Re:Vue.js vs. React by spion on Saturday August 19, 2017 @11:43AM (#15053988)
Personally I prefer the ternary operator in those cases, however I think do expressions will fix most of the if/else awkward stuff: https://babeljs.io/docs/plugins/transform-do-expressions/
Re:Vue.js vs. React by elyobo on Saturday August 19, 2017 @08:57PM (#15056417)
I'll use a ternary if I want something in the "else" case, but otherwise the `&&` / `||` approach is more readable to me (there's more to read in a ternary to figure out that there's nothing happening in the else case, whereas it's obvious with the boolean approach without reading further).
Re:Vue.js vs. React by gunn on Saturday August 19, 2017 @02:00PM (#15054678)
Can that actually help react look better here? I'm currently imagining:

  { do {
    if (condition_expression) {
      template_evaluation
    }
  }}
Re:Vue.js vs. React by spion on Saturday August 19, 2017 @03:25PM (#15055107)
For a single expression some of it can be omitted:

  { do { if (condition_expression) template_evaluation }}
But I gues thats not really better.

I'm hoping jsx will eventually default to `do` expressions though, and then it becomes

  { if (conditional_expression) template_evaluation }
Re:Vue.js vs. React by elyobo on Saturday August 19, 2017 @08:55PM (#15056411)
Hmmm, I really like the terseness and obviousness of that approach, I use it all the time :)

I have sometimes been caught out by doing `{somearray.length && thing}` though, which leaves `0` hanging out there in the false case...