Live data from Hacker News

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

mux.com

271–280 of 540 posts

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

#271

Earlier quoted context omitted.

Perhaps I can help? Which bundler? What issues are you encountering?

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.

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

#272

Earlier quoted context omitted.

Feels like bloated garbage to me. "Hold on, let me make an MVC React framework with a Node API, so you can call your APIs from another API!". Thanks Next.js. Really wanted this. Honestly, might as well go back to Angular at that point - no redundant "API" there, at least. Also, automagic, automagic everywhere. "Let me just intercept your request and send it to a HANDLER, wow." "Let me just have a magical 'getServerSi…

The API isn't redundant, it's convenient. You don't have to use it. Just delete the /api folder and make your requests either from the client side or fetch the data inside the handler that you're complaining about. With the new app router, you can fetch it from the server component itself without the handler.

Could you elaborate on the last point or link me please?

I disagree on the convenience point - it's bloat and not in the sense that people say "IDEs are bloat". It's regressive in going back to an MVC pattern in a framework that's meant to be an SPA and completely violates the "There should be one, and only one, way of doing things" principle in that it adds confusing options that people end up using in practice.

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

#273

Earlier quoted context omitted.

Sure, that's what we'll do! Sounds grand! By the way, we need to add another feature to our page, would you mind looking through that file so there are no class collisions? What do you mean its too long? 50k lines? Pfft.. But at least it 'gets transferred to the browser pretty fast'

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.

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

#274
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 never liked NodeJS; on the one side it was innovative in that its concurrency model allowed for faster back-ends, but a lot of the features of existing back-end languages like Java and PHP were still missing, so a lot of patterns were re-invented, the language itself needed years to get to the 'safety' levels that Java already had and PHP was working towards, and proven and standardized technology like XML and the…

EDI never became a thing. One of the greatest selling points of HTML/XML/JSON is that they are human-readable. Even if gzip compressed, most tools will decompress automatically and show you the raw text.

So the tooling nor library support never came for EDI (i.e., Chrome, libxml, etc.)

Also, if you really wanna go full-throttle binary for speed, size, etc., you probably don't want something heavy like XML anyway.

https://en.wikipedia.org/wiki/Comparison_of_data-serializati...

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

#275
post #11

Earlier quoted context omitted.

I also am baffled by the return to server side rendering as the new thing. It’s like people forgot that’s how it used to be. I’m sure they’ll claim it’s different now because… hydration or something or another. As a former PHP developer who spent a lot of time both working on server rendered pages and converting server rendered pages to be API/JS (render the core in HTML+JS and use APIs with two way data binding to u…

How much experience do you have with RSC and Next.js? I remember writing PHP and JSF back in the 90s and 00s, and the experience of both writing RSC and Next.js as well as using websites built with these technologies is simply not comparable.

[deleted]

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

#276

Earlier quoted context omitted.

Could you explain how the opt out/opt in works? Im a bit confused

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…

[deleted]

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

#277

I think i am getting old. These frameworks are so big and complex. For a simple web hello world you need a huge build and compile pipeline. And now its extended with serverside components. I really wonder what the overhead is. How many of layers of frontend and backend framework code is executed to get the hello world example running. I retreat back to my simple 10kb component framework in which i need only f5 to reb…

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 to what looks like an absolute hell-hole?" - Me

"But they should apply anyway if they know some of it!" - Him

No shit the quality of applicants is sometimes not the greatest

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

#278

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 are not your technology.

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

#279
post #154

Earlier quoted context omitted.

Well they don't look like they were created to manage complexity either, so exactly why are they used?

They simplify the on-boarding of 6 months boot-camped front-end developers. They can start working and delivering right away despite not being able to tell the difference between front/back ends and having no understanding of servers.

I can’t edit comment now. Not sure why some readers perceived my tone as negative. This is a neutral view and am just explaining why React server side is getting adoption and how this is being driven by the business side of things.

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

#280

In server-side rendering, clients are sent HTML that they can see immediately I noticed this too. You can put a plaintext file on the server and it gets transferred to the browser pretty fast. You can also put another plaintext file ending with .css on the server and it can make things on the first page move and look really nice just because the browser knows what to do with it. It’s a neat trick but still second to…

My brother just started learning web development this past year and his mind was blown when I told him you could send HTml over HTtp.

Please help the guy before he gets too far along. Some of us might have to work with him.

Seriously though, I saw someone described as a 22 yr old software engineer in an article. There is a better term: "Software Engineering Apprentice"

Post reply on HN