Live data from Hacker News

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

mux.com

281–290 of 540 posts

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

#281

Earlier quoted context omitted.

We're using Vite.js/esbuild, the bundler takes 2.5GB of RAM locally.

I can offer suggestions on code-splitting, but bundler memory consumption gets into the weeds quickly.

Yeah we all collectively had a look at it and there's not a lot of solutions available. The bundler needs to bundle everything at some point and you are going to pay the SPA tax.

That's why I personally don't recommend SPAs, it introduce a whole other class of issues on top of what you usually deal with. Google makes it work with Gmail and Youtube but it's Google, they can throw infinite engineers at any problem and could make those in pretty much anything.

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

#282

Earlier quoted context omitted.

This stuff appeals to a breed of management in the same way "full stack development" does, which is to say those in denial of the need or value of specialisation. The other benefit of such developers is they don't need teamwork. You just throw a feature request out at each dev and they do it end-to-end with you oblivious to the mess that is being created in the process.

Hah, that breed of management predates the JS world of crap. My current manager sees no problem in the job postings ridiculously listing every single language/platform we have worked with, even 30 year old 8086 projects, even when any new hire will most likely be touching none of that and will be writing some mundane C for an ARM. "It doesn't hurt to list everything!" - Him "Why the fuck would someone want to apply t…

I'm thinking of joining Kroger to help with the Albertsons merger. They are looking for Java developers, cool, some sanity. Learned they have decided to build all new stuff in Go. Like WTSF people? I can find no justification for building mundane business systems in Go. Ugh...managers.

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

#283

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…

Got it. Thanks for the thorough explanation

You bet. But if you grok that simple example, you can see why teams that switch to Svelte, Solid, Preact, or Vue feel "refreshed". This mental burden of trying to figure out what has to be put where just...goes away. The React model tries to bend JavaScript to conform to it's render cycle rather than designing to JavaScript's unique object-functional strengths.

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

#284

Earlier quoted context omitted.

Well, PHP has no client-side rendering, so it's a weird comparison

I had my own server side component system in PHP, 20 years ago. And when the marvel of AJAX happened I enabled some of the components to be requested separately by the client code, rendered and sent to the client to replace the part of the website they occupied when they were rendered when the page was served initially. Technically it wasn't client side rendering but it wasn't far from it. And for actual client side…

> And when the marvel of AJAX happened I enabled some of the components to be requested separately by the client code, rendered and sent to the client to replace the part of the website they occupied when they were rendered when the page was served initially.

I did the exact same thing. I made a page with a table that was fully rendered server side. Any change in the display, such as pagination, sorting or filtering would trigger the same PHP code that returned a HTML fragment. The Javascript for that was easy. Just send an AJAX request to the server and replace the element with the new content.

The PHP code itself was separated in components which made it easy to share the rendering logic for the initial page and the page used for the AJAX request.

React solves this in a more convenient way, but I am really surprised that we had to wait until 2023 before it happened.

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

#285
Word count:

complex: 9

complicated: 2

I've tried Nextjs's app router, and server/client components, and there are more footguns and gotchas than you can shake a stick at. Maybe it'll get smoothed out over time, but right now it is downright HARD to keep the mental model of your app when server and client code is constantly being intermingled, imported, and exported back and forth to each other.

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

#286

Earlier quoted context omitted.

As evidenced by the large numbers of production html and css apps that are outcompeting their competitors who use modern web technologies with greater product quality, and the swathes of customers who state their preference for these experiences. But seriously I have no idea of a single remotely well-known application that satisfies the above. If the modern web is so bad where are the products that prove that it can…

You are using one. Craigslist is the canonical example. There are actual forums of normies and the most notorious meme factory on the internet is hardly a wonder of UX technology. We are not on some subreddit for a reason.

> We are not on some subreddit for a reason.

This has other reasons though, like the fact that this site has better moderation and better users in general.

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

#287

"This was called client-side rendering (CSR) or single-page applications (SPA) and was widely considered a bad move." Why was it considered a bad move to go SPA? I generally disagree with this statement. But I feel like whenever this conversation comes up we're talking different applications altogether. A SPA is fine for a back office application. What it's not necessarily good for is a splash page or marketing page…

Author, here!

That line was a fun, sassy one. And probably a bit too strong. I definitely meant to temper it with the next few sentences.

> Sure, it’s simple, which is worth a lot! … And for frequently changing, highly interactive pages like a dashboard, it’s probably enough

I spent years working on a medical dashboard SPA and we never once seriously talked about SSR. They totally have a time and a place for web apps. I agree with you and I’m glad you brought it up.

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

#288
post #199

Earlier quoted context omitted.

If your career can be significantly affected by devs fresh from bootcamp, you probably need to sort out your own issues than to complain here mate.

That would assume quality is valued by an employer, versus shitt apps.

Checking boxes on a project plan seems to be the priority. Everything else is rather uninteresting to them.

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

#289
post #278

Earlier quoted context omitted.

Yeah 10 different files with 10k unorganized lines each is totally different :D I swear you js haters never fail to make me laugh with all the ignorant lamentations.

You are not your technology.

Im14andthisisdeep :) Did I ever say otherwise? Tools are invented to make things more convenient and not learning them properly is not an excuse to whine.

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

#290

Earlier quoted context omitted.

Be sure not to disturb this apprentice's troubled mind with such highly advanced topics as server side includes and related sorcery. Do not awaken the Ancients for only the pure of heart will survive such an encounter.

Yeah 10 different files with 10k unorganized lines each is totally different :D I swear you js haters never fail to make me laugh with all the ignorant lamentations.

You utter these heresies whilst holding 10k files each containing 10 demonic incantations.

Let us not sink into unproductive musings of the intellect, but meditate on the nature of the pendulum swing.

Post reply on HN