4 ms·
React has lived long enough to become the villain. It definitely pushed web apps in the correct direction, but it has grown some nasty kludges to account for th
by zamalek 3y ago
React has lived long enough to become the villain. It definitely pushed web apps in the correct direction, but it has grown some nasty kludges to account for things that were very hard to foresee. Choosing to use it nowadays for greenfields projects comes across as cargo cutting to me.
I somewhat disagree that the approach is ill-suited to simple sites, server-side JSX is a strong step in the right direction. If you're using it on the server you may as well use it on the client, even for minor interactivity problems.
- globular-toast 3y agoWhat would you use instead for greenfield?
- zamalek 3y agoFine-grained reactive, i.e. solid. Svelte works for that too.
- zer00eyz 3y ago> I somewhat disagree that the approach is ill-suited to simple sites, server-side JSX is a strong step in the right direction. Wow that sentence made me want to throw my laptop. I want you to build me a site that can be cached (think basic product shopping cart page) and then do the JS/hydration magic after the user has seen the render. Go ahead, and take your time, it's not a fun exercise in react. As for JSX on the server side... It was a shitty idea to mix presentation and code when PHP did it and got laughed at, JS/JSX isnt special. Templating languages are LIMITED for a reason. You know code/content/presentation all being separated is a good reason to do that...
- wonnage 3y agoYou’d rather write a bunch of nested React.createElement calls due to some unjustified religious hangup? JSX is sugar for a tree, it’s not that complicated
- zamalek 3y agoI was referring to static sites, which the post talks about quite a bit. JSX is just a sane templating language. Much of the hydration stuff is accidental completely, I would argue that all is with the advent of search engine scrapers that give the page some time to render. The goal of including associated data for the first render is essential complexity - it can save up to 200ms of latency, but there are simpler ways to do that (such as data islands, early hints, or SSE). At that point JSX is, again, nothing more than a really good templating language. Data islands are my choice because they worked in the 90s meaning they will certainly work today. XML back then, but JSON works just as well. Of course, hydration is assumed to be the only solution for the react-size-fits-all crowd.
- Gigachad 3y agoThis feels like some pseudo intellectual take. Choosing react for new projects is not “cargo culting”. It’s a proven and effective choice with a huge market to hire from. Meanwhile whatever server side renderer of the week framework you pick could be old news and abandoned in 5 years.