TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Is React Having an Angular.js Moment?

114 点作者 Ins43b将近 2 年前

20 条评论

soneca将近 2 年前
I 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.<p>&gt; <i>”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 React. Existing Next.js apps built with the Pages router will also work. So, the answer to the question &quot;Is React having an Angular.js moment?&quot; is &quot;No&quot;.”</i><p>&gt; <i>”So to the question &quot;Is React harming its community by being too ambitious&quot;, I think the answer is &quot;Yes&quot;”</i><p>The article is very good and well worth the read. I am inclined to agree that this is a NextJS move, that goes against the interests of React developers, with the goal of locking React developers in their own services. The React team is on board with this and playing along. I think they shouldn’t.
评论 #36212426 未加载
评论 #36217191 未加载
thomasfromcdnjs将近 2 年前
Agree heavily with the article. As an app developer, I actively spend my time walking away from frameworks&#x2F;languages&#x2F;libraries that start mashing the server weirdly into client code. Each to their own but I think quasi-RPC implementations are a relic of the past.<p>Treating the network layer as an explicit abstraction to components just feels a better developer experience in the long run. The data abstractions are easier to reason about, and caching albeit always hard, is a lot easier to think about.<p>I don&#x27;t even know _why_ React&#x2F;Next is pushing Server Components. (Part of me wants to join the conspiratorial bandwagon like the author)
评论 #36219373 未加载
scientaster2将近 2 年前
I&#x27;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.<p>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 &quot;use client&quot; wrappers that take in their parent data as initial state, then introducing client reactivity on top.<p>That^ also means that any time you drop into &quot;use client&quot; you drop any SSR benefits anyway. I agree with a lot of this article that the transition feels forced, and I can&#x27;t help but hope that Vercel commits to supporting pages style routing indefinitely.<p>Here&#x27;s an example, the pattern makes it almost impossible to highlight a currently active route in a navbar. Literally a basic building block of web applications: <a href="https:&#x2F;&#x2F;github.com&#x2F;vercel&#x2F;next.js&#x2F;issues&#x2F;43704">https:&#x2F;&#x2F;github.com&#x2F;vercel&#x2F;next.js&#x2F;issues&#x2F;43704</a>
评论 #36213653 未加载
评论 #36211905 未加载
thunderbong将近 2 年前
From the article <i>(italics mine)</i> -<p>&gt; So why is Next.js so pushy about it? <i>(React server components)</i><p>&gt; I can&#x27;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&#x27;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 is a product that can be sold. Perhaps I&#x27;m a conspiracy theorist, but I don&#x27;t see another reason to break the React ecosystem like this.
评论 #36214295 未加载
评论 #36212198 未加载
评论 #36213132 未加载
评论 #36212658 未加载
thdc将近 2 年前
I would argue it is quite similar to an Angular.js moment, even if it&#x27;s not a breaking change.<p>&gt; React suggests mixing server-side and client-side rendering, using what feels like black magic. You can use client components in server components, and vice versa.<p>This is reminiscent of hybrid Angular apps[1], which allows you to use both Angular.js and modern Angular components together and was introduced to help the upgrade from Angular.js to modern Angular. The only issue is the &quot;black magic&quot; there isn&#x27;t as good as advertised and you&#x27;ll run into many holes if working on a moderately complex hybrid Angular app.<p>I can only hope that the &quot;black magic&quot; for a mixed React app is more complete, though lack of documentation for the wire format that the author pointed out does not inspire confidence.<p>Interestingly enough, there is a picture of a tree of mix of components[2] on the Angular upgrade guide which parallels the one in tfa. It is basically why I think these scenarios mirror each other: an introduction to a new paradigm which can be used with the old one in a mixed&#x2F;hybrid application (and a possible lack of documentation which will make that application terrible to maintain without fully transitioning to the new or old paradigm).<p>[1] <a href="https:&#x2F;&#x2F;angular.io&#x2F;guide&#x2F;upgrade#how-ngupgrade-works" rel="nofollow">https:&#x2F;&#x2F;angular.io&#x2F;guide&#x2F;upgrade#how-ngupgrade-works</a><p>[2] <a href="https:&#x2F;&#x2F;angular.io&#x2F;generated&#x2F;images&#x2F;guide&#x2F;upgrade&#x2F;dom.png" rel="nofollow">https:&#x2F;&#x2F;angular.io&#x2F;generated&#x2F;images&#x2F;guide&#x2F;upgrade&#x2F;dom.png</a>
Merad将近 2 年前
I tend to agree with the article. I&#x27;ve felt pretty frustrated with the direction of react in the last few years. Most of the companies I&#x27;ve worked for that used react did so because they wanted a SPA, in most cases making a conscious decision to move away from older SSR technologies towards the SPA.<p>It&#x27;s doubly frustrating because we primarily use C# and Asp.Net Core for back end work. A react SPA is trivial to use with any back end of your choosing... this SSR push they&#x27;re making isn&#x27;t much fun unless you use a JS back end (no thanks).
评论 #36211855 未加载
评论 #36212227 未加载
评论 #36212021 未加载
mrcwinn将近 2 年前
Having experienced Vercel enterprise sales, I can confirm they are indeed the Death Star and will inadvertently destroy React.<p>Very happily using Phoenix LiveView these days.
评论 #36223591 未加载
marviel将近 2 年前
&gt; React Server components require new generation routers, new generation bundlers. They are officially in alpha, and not ready for production. So why is Next.js so pushy about it? I can&#x27;t avoid feeling that the new direction taken by Next.js is not designed to help developers, but to help Vercel <i>sell</i> React. You can&#x27;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 is a product that can be sold. Perhaps I&#x27;m a conspiracy theorist, but I don&#x27;t see another reason to break the React ecosystem like this.<p>I mean, yeah, I see your point.<p>React should always be self-hostable, full-stop.
spicyusername将近 2 年前
I think we as an industry underestimate the value of stability.<p>It&#x27;s easy to always look at what isn&#x27;t perfect and think, &quot;Hey, we know better now, let&#x27;s fix that&quot;, but what does more damage, architecture that isn&#x27;t perfect or constant change?<p>It&#x27;s hard to <i>really</i> get any momentum going when all the tooling changes every few years.
评论 #36212121 未加载
v0idzer0将近 2 年前
&gt; I can&#x27;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&#x27;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 is a product that can be sold. Perhaps I&#x27;m a conspiracy theorist, but I don&#x27;t see another reason to break the React ecosystem like this.<p>Feels like this inevitably ends in a fork. It was a hell of a run though!
评论 #36221235 未加载
评论 #36220469 未加载
fabian2k将近 2 年前
I think this is entirely a documentation and marketing issue at this point. React Server components are very new, probably new enough that most people should not use them unless they&#x27;re very comfortable working on the bleeding edge.<p>The problem is that React points towards Nextjs as a default, and Nextjs makes Server Components the new default.<p>It doesn&#x27;t actually change anything for anyone that still wants to develop a standard SPA. And these changes also don&#x27;t seem to make any of the old methods obsolete, they simply add another method that you can use to develop web apps.
Vanit将近 2 年前
React Server Components remind me of inline PHP with html. Wasn&#x27;t a good idea then. Not a good idea now.
评论 #36219849 未加载
andrewmcwatters将近 2 年前
Having? Had. React &lt;16.8 (Class Components) and React &gt;=16.8 (Hooks) are &quot;React.js&quot; and &quot;React 2.&quot;
resoluteteeth将近 2 年前
React has already through massive changes with emphasizing classes -&gt; function components -&gt; hooks.<p>OTOH it hasn&#x27;t broken backwards compatibility.<p>I think Server Components are similar to the introduction of hooks because while they require changes to use, they don&#x27;t affect anything if you aren&#x27;t using them.<p>You could argue that it&#x27;s such a massive change they should make it as a separate framework, but React&#x27;s approach of adding new approaches but maintaining compatibility seems to have been fairly popular.<p>Maybe server side rendering isn&#x27;t what everyone wants to do, but you don&#x27;t have to. I think we can all agree that if they were FORCING everyone to change what they&#x27;re doing and use server components it would be more of a problem?
评论 #36211805 未加载
the_third_wave将近 2 年前
There&#x27;s another aspect to server components and server-side rendering in general: it makes sites less amenable to third-party front ends. The rise of client-side rendered &quot;apps&quot;&#x2F;SPAs&#x2F;etc. and the accompanying APIs made it much easier to develop third-party front ends since the data became available in easily-parsed JSON or XML. Server-side rendered sites need to be scraped, a process which is far less robust than API access. Given that many site owners are quite adverse to third-party front ends - just look at the Reddit kerfuffle for an example - this limitation may well be one of the intended features.
solatic将近 2 年前
The author just doesn&#x27;t get it.<p>&gt; You can&#x27;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<p>I hate to break it to the author, but if you&#x27;re going to limit yourself to apps that don&#x27;t need a server, you&#x27;re going to limit yourself to only building toys. The real world is messy <i>because</i> you can&#x27;t pre-compile all your data into your single JS file ahead of time. Real-world apps <i>need</i> data stored in some kind of database, and some kind of server sitting in front of that database to validate access and present it in a format that can be used by the frontend.<p>Now, you can build that out in a different language, in a different repository, by a different team, behind a formal, stable API. At a certain scale, that&#x27;s even preferable. But when you&#x27;re building new products, when you&#x27;re trying to find product-market fit, the truth is, API design is just another distraction that doesn&#x27;t help you build value and just delays you from getting to market. What React Server Components does is allow developers to avoid API design. Sure, that doesn&#x27;t scale, but in the beginning, you should be doing things that don&#x27;t scale. Leaving aside the point that, if we&#x27;re being honest, most developers don&#x27;t know good API design anyway.<p>And no, just because Vercel is taking React in a server-first direction, doesn&#x27;t mean everyone is being forced into using Vercel for hosting. You can self-host NextJS anywhere you can run Node or Docker: <a href="https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;app&#x2F;building-your-application&#x2F;deploying#self-hosting" rel="nofollow">https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;app&#x2F;building-your-application&#x2F;deploy...</a> . Which you&#x27;re probably hosting anyway, because again, in the real world, you need to put something between your frontend and your database. That thing just doesn&#x27;t necessarily need to be an API.
filestorage将近 2 年前
since 2014 I was using angular.js. Since feb 2016 I&#x27;ve started to use Angular 2, which were a release-candidate version back then and became a stable release just in oct-nov 2016! So I don&#x27;t know what the author means by &quot;Just two years later (after 2012), the Angular team launched Angular 2&quot; but it definitely doesn&#x27;t smell good!!
revskill将近 2 年前
It&#x27;s a good thing. React team needs to keep up and keep fighting on the performance story.<p>Longer story: I hate ALL-in-one framework&#x2F;libraries.<p>I prefer separation of bundling, compiling, rendering,... . It&#x27;s called the SRP principle.
评论 #36211913 未加载
baerrie将近 2 年前
Tldr, React is overcomplicating things like Angular did
评论 #36240007 未加载
hoofhearted将近 2 年前
React is a component library, Angular is a framework.<p>We don’t really compare them apples to apples at work because they serve two different use cases.
评论 #36211640 未加载
评论 #36211593 未加载