News for hackers. Stuff that matters.
Re:Vue.js: the good, the meh, and the ugly by qudat on Thursday July 05, 2018 @05:58PM (#17467220)
It saddens me that JSX became so popular in the React community. I find the syntax verbose and hard to read ... similar to HTML.

At my last company we used `react-hyperscript` which was a simple wrapper around `react.createElement`.

Ultimately, the React developers made the mistake of making `createElement` so annoying to work with, I assume because they bought into JSX. Granted, JSX might have been necessary when React was first created in order to ease people into transitioning to HTML in JS, but I feel like we can move passed that now.

I highly recommend `react-hyperscript`: https://github.com/mlmorg/react-hyperscript

Re:Vue.js: the good, the meh, and the ugly by interlocutor on Thursday July 05, 2018 @07:51PM (#17467861)
If you care about compile-time checking (you would, if you work on medium to large applications) then JSX (or the TypeScript variant, TSX) is much better because it catches invalid or mistyped attribute names etc.
Re:Vue.js: the good, the meh, and the ugly by hoppelhase on Friday July 06, 2018 @11:07AM (#17471997)
Looking at the sample in the usage section, I don't see why you could not just write a declaration file that would catch wrong attributes and so on.
Re:Vue.js: the good, the meh, and the ugly by bodas on Friday July 06, 2018 @04:30AM (#17469851)
Only because it is more mature. No reason you can't write a linter for hyperscript.
Re:Vue.js: the good, the meh, and the ugly by nepeckman on Thursday July 05, 2018 @07:54PM (#17467875)
Agreed. Personally, I much prefer ClojureScript's approach to react, which is to use native vectors combined with keywords. So a component could be declared like this example from the re-frame framework. [:div.garbage-bin :on-click #(re-frame.core/dispatch [:delete-item item-id])] Easier to read, no need for an extra compile step or any non-native syntax.
Re:Vue.js: the good, the meh, and the ugly by aidenn0 on Saturday July 07, 2018 @08:47PM (#17481529)
about 30 seconds after learning react, I wrote a parenscript wrapper for it because I find the SGML syntax to be super annoying.

A translation from the JSX example that was the first (only?) example on the React homepage at the time:

https://github.com/jasom/parenscriptx/blob/master/example/co...

Re:Vue.js: the good, the meh, and the ugly by andreareina on Thursday July 05, 2018 @08:50PM (#17468118)
Last times I used hyperscript I just got lost in the sea of parens, brackets, and braces. Never had a problem with cl-who though, so don't really know what that's about.
Re:Vue.js: the good, the meh, and the ugly by dmitriid on Friday July 06, 2018 @05:37AM (#17470103)
You don't need JSX to work with React. JSX is a paper-thin DSL on top of `React.createElement`. Use that, if you want.
Re:Vue.js: the good, the meh, and the ugly by wetpaws on Thursday July 05, 2018 @06:21PM (#17467361)
excuse me if i'm wrong, but isn't it just a snippet for react.createElement?
Re:Vue.js: the good, the meh, and the ugly by aylmao on Thursday July 05, 2018 @06:43PM (#17467485)
react-hyperscript seems to also parse class names ('div.example'), ids ('h1#heading') and come with other goodies. Looks pretty interesting, and I appreciate they doing away with the need of a pre-processor ¯\_(ツ)_/¯
Re:Vue.js: the good, the meh, and the ugly by wetpaws on Friday July 06, 2018 @10:58AM (#17471927)
I looked through the code and it's about 40 lines long. I don't mind of people using small libraries like this, but it's a bit fun to see it presented as some kind of revelation :)
Re:Vue.js: the good, the meh, and the ugly by mosdl on Friday July 06, 2018 @12:01PM (#17472490)
How is html hard to read?