I've given server components with Next.js an honest try in my personal projects, and honestly, the pain of using them far outweighs the benefits. I MUCH prefer the pattern of getServerSideProps seeding data on-page-load and working with it via context providers. The fact that data loaded in with server components cannot support reactivity of any kind means you have to litter your code with "use client" wrappers that…
Oh man as a non fe person this is so overwhelming. I just got the hang of page based routing in nextjs and I still feel like I am walking on eggshells. Frankly all I want is TO render a next/jsx page into a jinja style template that I can render with backend of choice (golang) while leaving some ajax loading on the page when needed. I don't need my entire application to be a single page (don't get me started on under…
Is React Having an Angular.js Moment?
71–80 of 97 posts
Re: Is React Having an Angular.js Moment?
#72Earlier quoted context omitted.
Oh man as a non fe person this is so overwhelming. I just got the hang of page based routing in nextjs and I still feel like I am walking on eggshells. Frankly all I want is TO render a next/jsx page into a jinja style template that I can render with backend of choice (golang) while leaving some ajax loading on the page when needed. I don't need my entire application to be a single page (don't get me started on under…
You could use Go with templates and htmx, no js needed :-)
Re: Is React Having an Angular.js Moment?
#73Earlier quoted context omitted.
Svelte already has that and much simpler and more performant than react does. If they won't do it, they'll fall behind. With Svelte I can render a reactive statically rendered website. Nothing to my knowledge can do that in the JS framework world.
In my experience, Svelte made me much less productive because I was fighting with magic. I'd get stuck on obscure issues for hours.
With no experience, both seem like fighting with magic. I get stuck on obscure issues for hours.
I would have thought this whole process would be significantly more straight forward at this point.
Re: Is React Having an Angular.js Moment?
#74Earlier quoted context omitted.
If I understand correctly, this server side component technology is strictly JavaScript (or maybe Typescript etc.), so how can it be marketed as a step forward compared to having the React pages interact with any kind of back end through reasonably standard web services? Throwing away perfectly good backends and replacing them with new and relatively unproven JavaScript implies so much code churn, and novel deploymen…
> how can it be marketed as a step forward compared to having the React pages interact with any kind of back end through reasonably standard web services? With RSP you can implement a server function and (relatively) directly call it on the server, type-safely. Try doing that another back-end (I have and mostly failed).
Re: Is React Having an Angular.js Moment?
#75Having experienced Vercel enterprise sales, I can confirm they are indeed the Death Star and will inadvertently destroy React. Very happily using Phoenix LiveView these days.
I am already veering away from everything Vercel, didn't know RSC are so NextJS affiliated, this will certainly influence my library choices.
Re: Is React Having an Angular.js Moment?
#76Earlier quoted context omitted.
In my experience, Svelte made me much less productive because I was fighting with magic. I'd get stuck on obscure issues for hours.
I needed to learn something to build an app, and react was complex, so I tried Svelte. With no experience, both seem like fighting with magic. I get stuck on obscure issues for hours. I would have thought this whole process would be significantly more straight forward at this point.
The docs are pretty complete and well structured. There are of course obscure issues, but most of the footguns folks run into for typical use cases (e.g. doing something like using an array method and expecting reactivity) are well documented, and solutions on avoiding them are easy to find.
This means that if you do run into something which is not completely intuitive in Svelte, it's normally because there's not an intuitive way of doing it, which means you do more 'ad-hoc' learning as you try to work out what you need to do to get things working the way you want, and sometimes it's easy to fall into the trap of thinking that something that should work is not working.
React does less to 'hide' its magic and makes you work harder mentally up-front to understand what it's doing in terms of component lifecycle etc. In exchange, because it doesn't look as intuitive, you're a bit less surprised when it doesn't work.
For example, in Svelte, you might create something like:
const colours = ['red', 'white'];
Colours of the British Flag
{#each colours as colour}
{colour}
{/each}
colours.push('blue')}>Add blue!
If you click the button here, nothing happens, because you only mutated the array, which doesn't trigger reactivity. If you're not aware of this, you might not immediately understand that you've made a mistake.A similar React component would look something like:
function () {
const [colours, setColours] = useState(['red', 'white']);
return (
Colours of the British Flag
{colours.map(colour => ({colour}))}
colours.push('blue')}>Add blue!
)
};
You'll get an IDE warning that 'setColours' is unused, and anyway, you already wrote the code to destructure the 'setColours' function out of 'useState', so you theoretically should know that you need to use it, the mistake is 'clearer'.Re: Is React Having an Angular.js Moment?
#77Earlier quoted context omitted.
A lot of companies depend on search indexing from google and other platforms. E-Commerce, blogs, and trivial information websites all need their traffic to come from somewhere. If you were going to dynamically render the page anyways, why not do it in node with the best UI framework out there right now? The burden isn't that much when you put a caching CDN in front of it.
The things you've described do not require react.
Re: Is React Having an Angular.js Moment?
#78I've given server components with Next.js an honest try in my personal projects, and honestly, the pain of using them far outweighs the benefits. I MUCH prefer the pattern of getServerSideProps seeding data on-page-load and working with it via context providers. The fact that data loaded in with server components cannot support reactivity of any kind means you have to litter your code with "use client" wrappers that…
Oh man as a non fe person this is so overwhelming. I just got the hang of page based routing in nextjs and I still feel like I am walking on eggshells. Frankly all I want is TO render a next/jsx page into a jinja style template that I can render with backend of choice (golang) while leaving some ajax loading on the page when needed. I don't need my entire application to be a single page (don't get me started on under…
Re: Is React Having an Angular.js Moment?
#79From the article (italics mine) - > So why is Next.js so pushy about it? (React server components) > I can't avoid feeling that the new direction taken by Next.js is not designed to help developers, but to help Vercel sell React. You can't really sell a service around SPAs: once compiled, a SPA is a single JS file that can be hosted for free anywhere. But a server-side rendered app needs a server to run. And a server…
If you think that way, you are not objectively weighing the benefits of server side rendering. It _is_ useful and shouldn't be tossed away for the benefits of a 6MB javascript blob.
Re: Is React Having an Angular.js Moment?
#80I was ready to dismiss the article because the answer to the title question is an obvious “No”, as server components is not a breaking change. It’s optional. But the author addresses it and then makes a very good point. > ”The introduction of React Server Components, unlike the Angular.js to Angular 2 transition, is not a breaking change. Existing single-page applications will still work with the latest version of Re…
Svelte already has that and much simpler and more performant than react does. If they won't do it, they'll fall behind. With Svelte I can render a reactive statically rendered website. Nothing to my knowledge can do that in the JS framework world.
Regular old react without server components has been able to do this long before Svelte existed with SSR