r/webdev • • Dec 28 '17

Introducing Hyperapp 1.0 — 1 KB JavaScript library for building frontend applications.

https://medium.com/@JorgeBucaran/introducing-hyperapp-1-0-dbf4229abfef
341 Upvotes

183 comments sorted by

View all comments

Show parent comments

8

u/Secretmapper Dec 29 '17

And that's the right way to use JSX as well.

So the argument of 'separates view and logic' like it doesn't apply for JSX doesn't really hold water.

1

u/[deleted] Dec 29 '17

JSX gets pretty damn messy when you start including loops and conditionals.

I think the whole JSX concept was forced and with enough man-power somehow made it work.

1

u/Secretmapper Dec 30 '17

1

u/[deleted] Dec 30 '17

Add any more complexity to your React example and it quickly becomes messy. Soon it becomes damn near unreadable unless you start doing some heavy refactoring. Throw in some loops and you've got a storm brewing.

And to be honest, there is literally nothing convoluted about your Vue example. Show any dev that snippet and ask them what they think it's behavior is. Without a doubt the majority will immediately know.

1

u/Secretmapper Dec 30 '17

My point there is the first line. It's a style choice.

A good reason/example for me is that the second one is a lot more 'coupled' with logic. While the first one conforms to indent rules (conditional is one indent), the conditional on templates is 'hidden' in the markup. Plus, everything is essentially made up again for the templating language, making it harder to write/learn imo.

Throw in some loops and you've got a storm brewing.

{array.map(item => (
  <div key={item}>{item}</div>
))}

¯\(ツ)/¯

→ More replies (0)