Live data from Hacker News

Things I wish I knew before moving 50K lines of code to React Server Components

mux.com

331–340 of 540 posts

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#331
post #320

Earlier quoted context omitted.

Take this example: const { useState } = React; function Person(props) { console.log('Render Person'); return ( { props.identity.firstName } { props.identity.lastName } ); } function App (props) { console.log('Render Hello'); const [count, setCount] = useState(0); const einstein = { firstName: "Albert", lastName: "Einstein" }; return ( setCount(count + 1)}>Increment ); } ReactDOM.render( , document.getElementById('con…

After all this time, React's sheer tonnage of boilerplate still astonishes me. That abstraction leaks like useMemo(…) even need to exist in the first place… Folks want to solve their own problems, but they keep getting saddled with React's as well.

Evan You (creator of Vue) had a great quote on this:

    > The pain and suffering of hooks all roots from the mismatch between a dogmatic belief in the superiority of immutability and the harsh reality of the host language that is JavaScript (Feb 25, 2023)
This fundamental misalignment with React and JavaScript is the billion dollar mistake.

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#332
post #55

What I love about this is how PHP and JavaScript had basically the same syntax (minus a $ symbol here or a var keyword there), and then NodeJS was like, but we want to run JS on the server! And now, 15 years later JavaScript has finally caught up and it’s basically the same as PHP, but with more acronyms and a steeper learning curve (to be fair, streaming data from server to client components using suspense is cool).…

I do think a lot of the original reasons why NodeJS was created has been lost, since at that time, non-blocking IO created some great performance gains. In many "modern" developer minds, it's now relegated to a dumb tool to spit out JSON or host a toolchain.

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#333
post #316

Earlier quoted context omitted.

As a different perspective, I'm also old enough to remember when CSS and Javascript were invented , and I've been making websites since that time. IMO web dev has never seen better tooling than today, and user experience has improved tremendously over the years. What we used to call AJAX has grown from a neat side toy to a basic part of everyday life in the form of client components and SPAs. The server is still as p…

Well, React certainly has succeeded in increasing the client-side complexity, that's for sure. They seem to be making good inroads on increasing server-side complexity as well. Kudos to their contributions to excess CO2 emissions! I have yet to see a React project with more than five contributors fail to turn into a big ball of mud within 18-24 months, requiring either a periodic rewrite or resigned acceptance of tru…

Well, I've yet to see any web project of that scale survive more than 2 years. What do you think would be a better stack with similar frontend interactivity?

(Genuine question, not being snarky)

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#334
post #172
post #106

Earlier quoted context omitted.

Every CPU in the whole must regenerate websites from json descriptors. That's how it should always have been.

Why did we abandon XSLT?

XSLT still works in browsers believe it or not. It's great for making templated static sites.

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#335

Earlier quoted context omitted.

[flagged]

> Because they are called "libraries" for a reason, it can do much more than "Hello, World", and they are routinely used for much more than that. There you go.

> When you're writing a specific program, e.g. it's never going to be anything more than "Hello, world!", why would you use the fattest framework when you can write it in plain HTML?

Emphasised the parts I think you should re-read

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#337

I'm old enough to remember when servers rendered everything and you used CSS and Javascript to enhance the pages after they were rendered. The web is in such a dark and overengineered place. It's almost unbelievable. It's why my approach to building apps is server-rendered first and then enhanced after the fact.

You guys are using Javascript? I jest; our first geocities page was just HTML with maybe a visitor counter, marquee and whatnot. Our first PHP application / project in school actually didn't use JS yet, it used frames for a static menu and header and just straight form submission to get data to the back-end. Those were the days. But when I did my first college level internship (1 year of internships is part of colleg…

You guys used PHP? I started out with include directives with Apache, *.shtml files, and cgi-bin. SEO didn't even exist yet. You were either in the Yahoo! registry or you weren't. You just put your website URL at the bottom of the printed glossy brochures at the trade shows. "Mobile" wasn't a thing. Almost no one had any kind of cell phone. Pagers were still common. PalmPilots were brand spankin' new, a few hundred dollars (not including the 14.4kbps modem), and did not have web browsers.

(I'm not gonna claim things were better back then.)

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#338
post #316

Earlier quoted context omitted.

Well, React certainly has succeeded in increasing the client-side complexity, that's for sure. They seem to be making good inroads on increasing server-side complexity as well. Kudos to their contributions to excess CO2 emissions! I have yet to see a React project with more than five contributors fail to turn into a big ball of mud within 18-24 months, requiring either a periodic rewrite or resigned acceptance of tru…

Well, I've yet to see any web project of that scale survive more than 2 years. What do you think would be a better stack with similar frontend interactivity? (Genuine question, not being snarky)

I have seen Angular projects last pretty long avoiding code entropy. Angular is opinionated, rigid, and verbose, but goddamn if that structure and predictability don't pay off in the long term.

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#339

Earlier quoted context omitted.

> Because they are called "libraries" for a reason, it can do much more than "Hello, World", and they are routinely used for much more than that. There you go.

> When you're writing a specific program, e.g. it's never going to be anything more than "Hello, world!" , why would you use the fattest framework when you can write it in plain HTML? Emphasised the parts I think you should re-read

Sorry, I guess I disregarded it because I figured we were talking about serious programming, not literally "Hello world".

And if you're writing a single "Hello world", HTML is overkill. Make a free website on a random platform and literally just write "Hello world" in their WYSIWIG editor. Or hell, just serve plain text with "Hello world" inside, browsers will render it just fine.

Re: Things I wish I knew before moving 50K lines of code to React Server Components

#340

Earlier quoted context omitted.

Having a templating system in ‘that environment’ is worth its weight in gold IMO. I’ve been switching between Svelte and Django templates a lot lately, and Svelte just…knowing about the DOM, makes the experience so much nicer. I haven’t come across a non-JS template system that does this. And yes, I was there for PHP and jQuery and whatever.

We've had templating systems on the server-side for many decades? Do you mean having a javascript templating system maybe? Not really worth it's weight in gold.

I was using ASP with JScript on Microsoft IIS servers back in 1999. So yeah, many decades. :)
Post reply on HN