Hacker News new | ask | show | jobs
by jimmy1 2899 days ago
> I hate the JSX "everything is JavaScript" mentality

Would you object to things like unobtrusive javascript?

Things like unobtrusive javascript came to be because people recognized early on that HTML was not enoug for writing applications -- that you needed something more. Since basically the entire world has come to embrace unobtrusive javascript, it isn't a logical leap to embrace JSX.

https://medium.freecodecamp.org/react-s-jsx-the-other-side-o...

2 comments

Some people don't appreciate being required to run arbitrary code just to view an HTML page and the eye candy of JS is just not worth it.

Sure there are cases where JS is incredibly useful and beneficial, but your website should be able to display the majority of content with JS disabled.

Saying that "your website" should be able to "display" its "content" without JS seems to assume (as so many do) that the web is fundamentally a collection of articles (read them, look at the pictures, link to other articles) with a few exceptions, and keeping it that way is every developer's responsibility.

That's not what it is anymore. It has evolved into a general, distributed computing and communications platform. More and more uses of this platform require doing things that involve customized behaviors, not just the built-in features for displaying articles, so more and more people leave JS enabled. Kids who couldn't have afforded a family PC and MS Office now have a Chromebook at school (and maybe at home) and free Google Docs. And how many people whose only internet access device is a phone turn JS off in their phone?

I think it makes more sense now to treat the JS-disabled, article-browsing case as the exception. If I were trying to distribute public health articles as widely as possible, I would try to limit them to simple text, small photos, no JS, nothing that wouldn't have worked 20 years ago. And even for less-critical articles, if they were just simple articles, I'm still inclined to leave out the JavaScript in most cases for the sake of simplicity, reliability, reach, and archival robustness.

But for general purpose today, most developers in the developed world can assume JS is going to be enabled by the market they want to target.

> Sure there are cases where JS is incredibly useful and beneficial, but your website should be able to display the majority of content with JS disabled.

That's an entirely different discussion than what the parent was discussing though. This is about those cases where you're not building a static website.

"HTML was not enoug for writing applications"

That particular argument doesn't make a case of React or Vue's approach being particularly better than the other.

In the author's conclusion he states, "JSX isn’t revolutionary. It’s evolutionary. Like most forms of evolution, it’s a clear improvement."

I will concede the author's point that React & JSX are better than the jQuery spaghetti that came before and is therefore an improvement. As the comparison here is to that of evolution which is superior the shark or the tiger? With evolution many things will evolve out of those things that came before and the strong will survive. Vue and React are both evolutions of what came before; time will tell which, if either, survives.