News for hackers. Stuff that matters.
Re:What React Gets Wrong by zer0tonin on Thursday January 07, 2021 @05:10PM (#25678313)
What's wrong with writing only JSX tho?
Re:What React Gets Wrong by DaiPlusPlus on Thursday January 07, 2021 @05:18PM (#25678415)
JSX is nice, but requires transpilation as JSX can’t be used by browsers directly. And as soon as you need a transpilation step you’ve opened yourself up to npm-hell with Babel, Uglify, Rollup/WebPack, etc - at which point people ask themselves why they’re even using JavsScript instead of TypeScript or going all-in on WASM.
Re:What React Gets Wrong by econnors on Thursday January 07, 2021 @05:21PM (#25678458)
Those tools do useful things. Forbidding developers to use arrow function syntax because you need to support IE11 isn't a winning formula.
Re:What React Gets Wrong by vorpalhex on Thursday January 07, 2021 @05:28PM (#25678549)
Microsoft doesn't support IE11 anymore. You're probably safe to write modern JS unless you're in a very, very narrow niche.
Re:What React Gets Wrong by nicoburns on Thursday January 07, 2021 @05:45PM (#25678724)
That's not true https://docs.microsoft.com/en-us/lifecycle/faq/internet-expl...

And plenty of enterprises are still using it.

Re:What React Gets Wrong by DaiPlusPlus on Thursday January 07, 2021 @06:32PM (#25679162)
> And plenty of enterprises are still using it.

...but only as a back-up browser for those legacy internal web-applications. I’m sure all of them still install Chrome (or Chromium-Edge) for daily-browsing.

Re:What React Gets Wrong by nicoburns on Thursday January 07, 2021 @06:51PM (#25679363)
We sell into the NHS, and we still have high numbers of users on IE11 (and it's in our contract to support it). Chrome is definitely on the increase though.
Re:What React Gets Wrong by DaiPlusPlus on Thursday January 07, 2021 @05:27PM (#25678535)
Forbidding your developers from using arrow-functions such that you don’t need a JS build process can be justified.
Re:What React Gets Wrong by rhacker on Thursday January 07, 2021 @08:57PM (#25680468)
Maybe a stupid question, but what kind of projects are ones where you don't need or want a build process?
Re:What React Gets Wrong by DaiPlusPlus on Thursday January 07, 2021 @09:48PM (#25680903)
Simple projects!

Projects where the client isn’t programmer-savvy and wants to make changes themselves and immediately upload them over FTP. Sites like self-hosted WordPress or hand-maintained static websites.

Re:What React Gets Wrong by Nkuna on Friday January 08, 2021 @01:41PM (#25688161)
> Simple projects!

WP sites are far from simple. Maybe WordPress.com but definitely not the self host option. Not if you want anything other than a vanilla install.

> the client isn’t programmer-savvy > wants to make changes themselves and immediately upload them over FTP.

Why would you want a client who isn't savvy to make changes themself? Advocating for cowboy coding for end users is trolling... unless you're upselling a support package!? They can tweak things in the admin but I'd think long and hard before giving said client access to server files. Not to mention how easily end users mess things up by changing admin settings.

Having worked with such clients for 2 years, I gave up because at some point, the support burden was just too much!

Re:What React Gets Wrong by dragonwriter on Thursday January 07, 2021 @05:41PM (#25678685)
> JSX is nice, but requires transpilation as JSX can’t be used by browsers directly. And as soon as you need a transpilation step you’ve opened yourself up to npm-hell with Babel, Uglify, Rollup/WebPack, etc - at which point people ask themselves why they’re even using JavsScript instead of TypeScript

React is fine with TypeScript, too.

“If you are using React, you might as well also use TypeScript instead of just JS” may be true, but I don’t see how its a problem.

Re:What React Gets Wrong by postalrat on Thursday January 07, 2021 @05:27PM (#25678536)
The jump from javascript to typescript is trivial compared to the jump to some sort of framework built on wasm.
Re:What React Gets Wrong by tiborsaas on Thursday January 07, 2021 @05:28PM (#25678545)
Nothing. It's a great innovation in web development and UI declaration to be more precise. I was skeptical for a while, but when started writing it it became natural real fast.
Re:What React Gets Wrong by jehna1 on Thursday January 07, 2021 @05:20PM (#25678430)
It's not part of Javascript, so you'll always need Babel (or similar transpiler) as a dependency and some kind of build step.

It's additional complexity when you could have solved the same issue by using better design on the API level.

Re:What React Gets Wrong by sojournerc on Thursday January 07, 2021 @05:23PM (#25678493)
Typescript transpiles JSX, which doesn't disprove your point at all, but it's worth mentioning.

I don't intend to ever write un-typed, naked javascript again if I don't have to.

Even scripting, ts-node is perfect for it.

And as far as complexity - I find typescript to be far better than webpack/babel in configuration and UX.