Live data from Hacker News

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

mux.com

251–260 of 540 posts

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

#251
post #132

Earlier quoted context omitted.

You literally just run: > npx create-next-app@latest Press Enter a few times for default settings and voila, you have a hello world app up and ready to run.

- npx create-next-app@latest - npx: command not found - install node / npx - npx create-next-app@latest - realise your node is too old - install nvm / node - npx create-next-app@latest - answer a bunch of questions - npm start - get an error: Error: ENOENT: no such file or directory, open '/tmp/my-app/.next/BUILD_ID' - npm run dev - hello world in browser

Don't forget, Next.js has telemetry by default unless you run:

  npx next telemetry disable
Or set environment variable:

  NEXT_TELEMETRY_DISABLED=1

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

#252
post #119

Earlier quoted context omitted.

Why use kubernetes and the cloud when you can FTP or rsync your code onto a box? Simpler times.

I just ssh to the server and edit the code there, I never understood why people need to have two whole environments that they keep in sync. (though seriously, in my dorm room in the 90s, my pentium 90 desktop at the end of my bed had a fixed IP address and was the server...)

Now add 5 people doing that at the same time and report back on how scaleable that solution is.

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

#253

Earlier quoted context omitted.

What kills me is that many websites would be better in every way if they were just html and css. I have come to think of it as premature optimization for some fancy capability down the road. It's like telling people they have to hire engineers to take core samples and do seismic modeling before building a chicken coop.

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.

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

#254

Earlier quoted context omitted.

For sure. Ever had to debug a bug deep inside of a webpage's code that relied on 5-10 preconditions to get it to appear? Without HMR, you're spending a lot of time F5ing and navigating to reproduce/fix it.

If only there was a way to programmatically reproduce the conditions under which the problem appears and then exercise the behaviour that triggers the bug. Then some code could verify whether the problem still appears. Once the problem is fixed this same “test” dark magic could help ensure the problem does not occur again. Pipe dreams, my friends. Pipe dreams.

`git bisect` with an integration test suite of the backend running in a test environment can get you pretty close.

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

#255

Earlier quoted context omitted.

This is precisely why you see this move from complexity. The younger devs are beginning to see it. Just like we dumped atrocities like SOAP and XML in favor of simpler and more ergonomic tech, this generation is learning - again - that complexity kills (and makes this job intolerable). Who knows, maybe software development is going to be fun again, even if for a few years before the new batch starts turning it into a…

After kicking and screaming about learning yet another React framework I took the time to build an app fresh in NextJS and it really was a breath of fresh air, felt more like a mature, simpler form of React.

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 'getServerSideProps' function that will do magic and generate component props, but it has to live in the page, so the page gets extremely bloated, oooo."

I hate Next. And I realize "hate" is a strong word that takes some earning.

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

#256
post #130

Earlier quoted context omitted.

React is as baked in now as Java and Covid.

A little over 10 years ago we were saying this about jQuery. React definitely solves problems that jQuery just couldn't solve well. I know that there are issues in react we still need to address, so I know it will be a matter of time before some new way is developed that will supplant react and we will talk of react then as we talk of jQuery today.

React is orders of magnitude more embedded than jQuery ever was.

On top of that, the breadth and depth of its complexity and ecosystem and the solutions it helped build means it's really not going away in a hurry.

Updating a 2013 site from jQuery to Angular was small potatoes compared to updating a site now from react to react2.

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

#257
post #242

Earlier quoted context omitted.

This is precisely why you see this move from complexity. The younger devs are beginning to see it. Just like we dumped atrocities like SOAP and XML in favor of simpler and more ergonomic tech, this generation is learning - again - that complexity kills (and makes this job intolerable). Who knows, maybe software development is going to be fun again, even if for a few years before the new batch starts turning it into a…

It's not happening fast enough. For greenfield projects, new startups, sure. But the rest of us stuck in legacy-land the toxic waste dumps of these over-engineered behemoths will be with us for years to come.

See my comment above - it's greenfield projects too. Company I work for had a nice .NET Core / Gatsby React set up with reasonable Microservices on Azure. New leadership came in. Rewrote it "all" (3 years in so far) into a wait for it, MONOREPO! in Python (at least they used FastAPI), Next.js (just to have a useless API which calls other APIs, because apparently 'cookies are more secure than JWTs' (I guess they think not being able to fetch them in JS is somehow security), and AWS. So far it has half the functionality, 10x the libraries, 100x the confusion, but hey, at least we went from 5 devs to 100 just so everyone can be confused TOGETHER!

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

#258

Earlier quoted context omitted.

Yet performance is abysmal. I clicked on “API reference” and nothing happened for a second. Then the submenu opened in the sidebar. Another second later the content view updated. There is no indication of anything loading, there are no network requests to await. Incredibly, it’s dog slow on an M1 Mac. If the viewport is 800 px or narrower, click on the menu icon (horizontal bars, top right), then click on a sidebar l…

Good lord it’s awful haha. Some more unhinged stuff I noticed: - swiping backwards exists the drop down menu for some inexplicable reason - clicks on menu bar items take so long I genuinely thought I hadn’t tapped on it correctly. - taps on the menu bar sometimes just don’t work. Like, at all. Oh scratch that, the menu was there after I swapped tabs to write this sentence. - massive chunks load in at different times:…

There's something to be said for optimistic routing, server or client side. It seems like they're using suspense to wait for the page to be rendered before swapping the route. It's a noticeable breach of the standard pattern of instant navigation, and then wait for content to appear.

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

#259
post #154

Earlier quoted context omitted.

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.

To be fair, we tend appreciate these kind of features when we are on the other side, buying, say, IKEA furniture. I respect, but don't particularly want to support professional carpenters if given the alternative. E.g. you can have cheap shit now or wildly expensive "proper" products later where the "proper" means something I do not and can not appreciate - to put it simply I know wood is made from trees and there en…

User testing Ikea assembly must be an interesting challenge, partly because experience in the test group would make you better at later tests.

I have worked on international teams where it was a running joke the individuals had ended up assembling the same Ikea furniture on three continents.

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

#260
post #240

Earlier quoted context omitted.

F5ing to refresh is a heavier workflow than the hot-reload/refresh you get with every modern web framework.

First, HMR doesn’t magically put you into a specific program state. Second, you can still HMR any website, as it is a feature of a bundler, not a web framework.

HMR is a feature of bundlers but your frontend code has to specifically interface with it if you want JS changes to live-apply to a running page without losing state instead of refreshing the page. With React, you have to use react-refresh in order to have HMR support. Frameworks like NextJS configure react-refresh and the bundler's HMR features together for you.
Post reply on HN