zlacker

[parent] [thread] 8 comments
1. danabr+(OP)[view] [source] 2025-12-03 20:03:42
Server Components is not really related to SSR.

I like to think of Server Components as componentized BFF ("backend for frontend") layer. Each piece of UI has some associated "API" with it (whether REST endpoints, GraphQL, RPC, or what have you). Server Components let you express the dependency between the "backend piece" and the "frontend piece" as an import, instead of as a `fetch` (client calling server) or a <script> (server calling client). You can still have an API layer of course, but this gives you a syntactical way to express that there's a piece of backend that prepares data for this piece of frontend.

This resolves tensions between evolving both sides: the each piece of backend always prepares the exact data the corresponding piece of frontend needs because they're literally bound by a function call (or rather JSX). This also lets you load data as granularly as you want without blocking (very nice when you have a low-latency data layer).

Of course you can still have a traditional REST API if you want. But you can also have UI-specific server computation in the middle. There's inherent tension between the data needed to display the UI (a view model) and the way the data is stored (database model); RSC gives you a place to put UI-specific logic that should execute on the backend but keeps composability benefits of components.

replies(3): >>halfli+B4 >>rand17+Uj1 >>fabiob+oN1
2. halfli+B4[view] [source] 2025-12-03 20:23:26
>>danabr+(OP)
Thanks for the comment Dan, I always appreciate you commenting and explaining in civility, and I’m sorry if I came a bit harsh.

I understand the logic, but there are several issues I can think of.

1 - as I said, SSR and API layers are good enough, so investing heavily in RSC when the hooks development experience is still so lacking seems weird to me. React always hailed itself as the “just JS framework”, but you can’t actually write regular JS in components since hooks have so many rules that bind the developer in a very specific way of writing code.

2 - as react was always celebrated as an unopinionated framework, RSC creates a deep coupling between 2 layers which were classically very far apart.

Here are a list of things that would rather have react provide:

- advanced form functionality that binds to model, and supports validation

- i18n, angular has the translations compiled into the application and fetching a massive json with translations is not needed

- signals, for proper reactive state

- better templating ability for control flows

- native animation library

All of these things are important so I wouldn’t have to learn each new project’s permutation of the libraries de jour.

replies(2): >>IgorPa+Iz1 >>mexico+t32
3. rand17+Uj1[view] [source] 2025-12-04 06:22:52
>>danabr+(OP)
You either die a hero or live long enough to see yourself become the villain. The amount of time I've spent debugging other PRs (and mine) around hooks is just unruly, then React turned its attention to the server, something that I (most of us? we?) never ever asked for; but I guess that's what Meta, a company of cancer needs. I sure don't need it. Never have I imagined during the last 15 years that I'll be happy to say I'm using the mountain of enterprise spaghetti called Angular, but now I am. For years I hoped I'll be able to get back to React projects one day; that hope is long gone.
◧◩
4. IgorPa+Iz1[view] [source] [discussion] 2025-12-04 09:02:07
>>halfli+B4
Do you have a moment to talk about our Lord and Savior VueJS?
5. fabiob+oN1[view] [source] 2025-12-04 11:05:14
>>danabr+(OP)
As merely a systems engineer sometimes having to create a Web app I really much appreciate the experience of building a well-separated app without layers of trivial but flaky boilerplate layers that is a REST API in a dynamic language. The Next app I built last year using heavily RSC is one of the most legible and easy-to-maintain apps I have created so far.

We'll see if the magic can be trusted on or if we need more explicit solutions to this, but the Next/RSC experience was vastly superior compared to writing another REST API that is never to be used with anything else than the accompanied React app, and I'd love to use it or something similar to it in the future.

The reason is probably that a REST API for a "BFF" is in many cases quite tightly coupled with the frontend, and trying to detach those in the system architecture does not separate them in some higher scheme of things. Even if the two parts could separated but would never end up used without another, the separation probably just makes an unnecessary barrier.

replies(1): >>fabiob+aO1
◧◩
6. fabiob+aO1[view] [source] [discussion] 2025-12-04 11:13:38
>>fabiob+oN1
I mean the different aspects of my Next app are now clearly separated, but they do form functional units. The separation between frontend and BFF is gone, but that was a wrong boundary in small scale apps to begin with.
◧◩
7. mexico+t32[view] [source] [discussion] 2025-12-04 13:04:44
>>halfli+B4
> React always hailed itself as the “just JS framework”,

I've literally never heard someone say "React is just a JS framework". They've said React uses JSX over templates. And that React has introduced functional components. But never heard someone say what you're claiming.

> but you can’t actually write regular JS in components since hooks have so many rules that bind the developer in a very specific way of writing code.

This is wild. Yes you can. You can write regular JS in components. I can go build a component right now that uses JS (either with or without hooks). You're conflating the rules of hooks with the ability to use Javascript. Yes, there are rules. No, that doesn't mean you can no longer can write JS.

> i18n, angular has the translations compiled into the application and fetching a massive json with translations is not needed

Tradeoffs. Now each update needs to be rebuilt and redeployed. I don't have that problem in React.

> better templating ability for control flows

Better templating? React uses JSX. Are you saying there exists a better way to control flows than if/else?

> signals, for proper reactive state

This has been debated ad-nauseum in the React community and everything has a trade-off. I wish people would stop saying this as if it's categorically correct. React is UI is a function of state. Singlars would totally break the current mental model of React. Data flows down. This change would come with tradeoffs.

replies(1): >>halfli+qg2
◧◩◪
8. halfli+qg2[view] [source] [discussion] 2025-12-04 14:27:41
>>mexico+t32
I’ve heard, especially during the first few years when react was introduced, that you don’t need templating, compiler, or anything special to write react, “it’s just JS”.

Of course you CAN write anything you want inside a component, but then it breaks, or has awful performance. To write components the proper way you can’t use any control flows with state management, you need to keep remembering which are the correct dependencies to recreate state, it makes components 20% BL and 80% react logic.

You can’t use if-else in JSX, since only expressions are allowed. So you need to create nested ternaries, which are hard to read, or using JS anomalies like having a condition expression return the last truthish evaluation.

And regarding signals, preact is using it and it doesn’t seem to break anything there.

Function of a state has a nice ring to it, but eventually this was solved a long time before react, every templating engine is a function of a state. The hard part is composing the state easily which react has never been able to achieve.

replies(1): >>anthon+Vk2
◧◩◪◨
9. anthon+Vk2[view] [source] [discussion] 2025-12-04 14:53:24
>>halfli+qg2
> that you don’t need templating, compiler, or anything special to write react, “it’s just JS”

This is still true. I don't currently use any of those things. And the existance of a compiler does imply you can't write Javascript. Totally different concepts. Also, pretty sure they had compiler plans for like years now.

> but then it breaks, or has awful performance.

You're gonna have to be more specific. I could repeat that sentence for every programming language/library on the planet and without specifics it would make sense.

> You can’t use if-else in JSX,

I don't need to use if-else in JSX to control flow. I can write if(condition) return html;

> which are hard to read, or using JS anomalies like having a condition expression return the last truthish evaluation.

See the sentence I just wrote before this. I can use if/else to control flow and return early without templating. How is that not ideal?

> And regarding signals, preact is using it and it doesn’t seem to break anything there.

It's not about literlaly "breaking" something. They could implement htem if they wanted to. It's about breaking the mental model.

In React, data flows down. That's a constraint, but not always a bad one. I know exactly where to look for data (up). With signals, that's throw out the window. And now, it's not just about what the component accepts via props/context (which again, is down) it now needs to turn itself on it's head.

I used Angular for years before React and I do not miss having things talking to each other throw multiple lateral levels.

> Function of a state has a nice ring to it, but eventually this was solved a long time before react, every templating engine is a function of a state.

> Function of a state has a nice ring to it, but eventually this was solved a long time before react, every templating engine is a function of a state. The hard part is composing the state easily which react has never been able to achieve.

This is incredibly misleading (and wrong). Templates don't compose. And React is quite literlaly the king of composition.

It's starting to feel like you've never actually used React, but instead are basing your opinions on what you see other people say (who have also not used React).

[go to top]