6 ms·
"JSX is a gotcha-riddled kludge to clumsily shoehorn HTML into a JavaScript function return." Author's opinion, and one I find very strange. JSX with TypeScrip
by davedx 4y ago
"JSX is a gotcha-riddled kludge to clumsily shoehorn HTML into a JavaScript function return."
Author's opinion, and one I find very strange. JSX with TypeScript is one of the best features of React, it's a dream compared to Angular's awkward arcane syntax (that didn't have type checking until what, a year or two ago?).
I get that people don't like React, that's fine. But "React is popular because it's popular" is an intellectually dishonest argument. There are obviously good reasons technically competent people choose it for projects.
- Induane 4y agoI think it's a combination of the network effect along with the "good enough" element. There is a point where a framework gains inertia regardless of whether or not there are better offerings simply because it's what people are used to. Companies like solutions where there is an substantial pool of developers from which to choose. Etc... It might actually be popular because it's popular; that isn't necessarily a dishonest argument on it's own. But usually when something is popular because it's popular it's also technically competent to enough of a degree that it's good enough.
- joshmanders 4y agoOr... hear me out... None of the existing alternatives really have been good enough to completely rewrite their applications for. It's disingenuous to say that React got popular for no reason and now people just don't want to change. React-isms ooze all over everything that came after it. If it was just "meh, good enough" until something better came out, then why does Preact name itself after React and have a react-compat mode and base itself on JSX? If React was just "meh, good enough" then why does every other framework out there take inspiration from React and when React came out with something all these other frameworks came out with their implementation of that feature?
- Cthulhu_ 4y agoBut Angular's even older than React is at this point. That said, React gained a lot of popularity while Angular was in the limbo of AngularJS to Angular 2; I think a lot of people switched up then. I'm currently doing Angular again and I hate it (especially combined with NgRx, why do I need half a dozen observables, reducers, actions, selectors, etc just to make a HTTP request?), it's a step back from React in my last assignment; React's functional style with hooks and react-query was a great combo. I'm not saying it's the best, but it worked for me. For my next trick, I should learn Vue. Although on the other hand, front-end fatigue kicked in years ago. It's just the same thing again; some forms, validation, layout/style and a REST API, just using the tool-du-jour. Sigh.
- Induane 4y agoFor personal projects I'm now using HTMX & HyperScript + Django (I have a custom middleware and view class I wrote that steamlines a lot of it). That's helped a ton with the frontend fatigue for me. All the benefits of a SPA without writing any JS. So far I've not gotten to use that stack professionally, but I'd sure love to.
- addicted 4y agoWasn’t the Angular to Angular 2 switch driven by React? I distinctly remember when React came out, pretty much every framework out there had to pivot to incorporate at least one of the 2 major ideas React brought with it (or at least, these were the most immediately beneficial features at a time when IE was still officially supported). The virtual DOM and one way data binding. One way data binding didn’t even exist as an option in any other web framework and it was such a breath of fresh air. In fact, competing frameworks used to strongly advertise the fact that they had 2 way binding and how awesome it was. And 2 way binding looked great in your toy TodoMVC app, but absolutely failed when developing applications for real world use. And the virtual DOM was so much faster when it first came out.
- Smhlol00 4y ago
- zero_shift 4y agoSome context: the author only has three years of professional experience https://www.linkedin.com/in/joshcollinsworth https://www.linkedin.com/in/joshcollinsworth
- neon_electro 4y agoYou discount the 4 years they spent at Flywheel 2015-2019.
- zero_shift 4y agoThat's as a support engineer, which is quite a different job. I should have said "software engineering experience" instead of "professional experience". I'm not impugning the author, but it does provide context as to why he may not understand React's design choices.
- markeibes 4y agoI write React without JSX. That's a beautiful thing. I don't think I could forego the weird invented syntaxes of vue or whatever.
- hbrn 4y agoThere's React Stockholm Syndrome: downsides of React are often praised. Somehow people think there's a lot of foresight and wisdom in JSX invention. There's just so many good properties JSX has. But JSX was merely an easiest solution to an immediate problem. Think about how React was created: 1. DOM management complexity gets out of hand. You solve it by treating view as a function of state (great idea btw). 2. If you do it naively, it is going to be slow. You make it performant with VirtualDOM. 3. Now that you went with VDOM, writing HTML is a nightmare. You address it with JSX. JSX is obviously a great replacement for manually written render functions. But you know what's even better? Not writing render functions at all. Same with setState() vs MobX/VueJS approaches. setState() was (is?) a horrible way to manage state. But it was the easiest thing that allowed you to implement V = F(S) formula at the time. setState() a cost, not a benefit. JSX is a cost, not a benefit. I wish people stopped praising it.
- ithrow 4y agoWhat is your recommendation for web apps that are not highly interactive but need interactivity to improve the UX?
- hbrn 4y agoAll the major frameworks require you to work off a foundation that's built for high interactivity, and I believe going with one of the major ones (except Angular) is still a good bet. Technically you can use Vue as a library to add interactivity. It works ok, but you'll switch to compilation eventually. Still in my opinion Vue strikes good balance between getting shit done and developer experience. Svelte would be my next bet, I just don't have enough experience with it to recommend it.
- s__s 4y agoSomething like Alpine JS or similar would make sense for a project like that. https://alpinejs.dev/ https://alpinejs.dev/
- Induane 4y agoHTMX & _hyperscript