TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

New React docs pretend SPAs don't exist anymore

199 pointsby matijashabout 2 years ago

37 comments

AgentMEabout 2 years ago
This comment thread is a little funny because every single HN thread outside of this one rants super aggressively about webpages that don't show any content before JS loads, but this thread has managed to collect the opposite group together for once because React's docs have updated to stop actively recommending tools that force that problem to happen.
评论 #35204497 未加载
评论 #35204576 未加载
评论 #35210574 未加载
评论 #35211842 未加载
评论 #35211224 未加载
评论 #35204919 未加载
bryikabout 2 years ago
I don&#x27;t think that&#x27;s a fair characterization of the &quot;Start a New React Project&quot; page [0]. Next.js is the first option listed and is described as a way to &quot;create React apps of any size—from a mostly static blog to a complex dynamic application.&quot;<p>This reads to me like &quot;Next.js can do SPAs (like CRA) plus static sites and SSR&quot;. Next.js&#x27; site even says &quot;The core of Next.js has been designed to enable starting as a static site (or <i>Single-Page Application</i>)&quot; [1].<p>0 - <a href="https:&#x2F;&#x2F;react.dev&#x2F;learn&#x2F;start-a-new-react-project" rel="nofollow">https:&#x2F;&#x2F;react.dev&#x2F;learn&#x2F;start-a-new-react-project</a><p>1 - <a href="https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;advanced-features&#x2F;static-html-export" rel="nofollow">https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;advanced-features&#x2F;static-html-export</a>
评论 #35212190 未加载
评论 #35204199 未加载
评论 #35204216 未加载
评论 #35218056 未加载
nvlnabout 2 years ago
Does anyone else feel that the complexity of the full-stack frameworks is getting untenable?<p>1. There is a significant gap between dev and production environments. (See #2 why this is critical)<p>2. The production build times are super high<p>3. ES modules are great, but the JS ecosystem being a bundle of small libraries, getting them all to play nice is hard.<p>4. I occasionally get X is included twice errors that are painful to track and debug<p>5. There are frequent instances where I find out that the very problem I had has been solved by someone, but they don&#x27;t know how or why. They remove a, b, c then it works. They add it back, it still continues to work.<p>What happened to KISS?
评论 #35209192 未加载
评论 #35211622 未加载
评论 #35211651 未加载
评论 #35212067 未加载
评论 #35217299 未加载
评论 #35209258 未加载
评论 #35210175 未加载
评论 #35226769 未加载
评论 #35219783 未加载
ralusekabout 2 years ago
There are a myriad of reasons why I prefer SPA to server rendered content for most applications. The main exception is if I have a public facing, unauthenticated application that I need indexed, I&#x27;ll go for SSR.<p>Off the top of my head, here are benefits to SPA:<p>- I can just serve a few static files from a CDN. Every user gets the same client.<p>- Most requests made by the application are actually smaller. I&#x27;m just loading the data I need, rather than the data, markup and styling.<p>- It&#x27;s an actual client application talking to a data API. It&#x27;s the same API the rest of my client applications are talking to, be it a mobile API, native, CLI, etc.<p>- It&#x27;s a much easier mental model. Interactivity without having to give consideration to whether or not it will disrupt whether it can be rendered. I build my application like a realtime application and just make requests for the data I need when I need it<p>- I don&#x27;t have to think about exposing backend secrets, or trying to do things I&#x27;m mistakenly assuming to necessarily run in one environment or the other<p>- I can be much more explicit about loading and caching data when I would like to<p>Even most of the cons of a SPA can be ameliorated. The biggest con is a larger up front load, but that can be mitigated by code splitting and lazy loading. The fact that it&#x27;s a handful of static files means that the application is basically cached, too. And SPAs are for applications, not websites. Most people using SPAs want the application experience to be optimal, not necessarily their initial first time load. They want small requests, interactivity, live feedback. This is all possible with SSR, but nowhere near as simple.
评论 #35204789 未加载
评论 #35216922 未加载
评论 #35204663 未加载
评论 #35204591 未加载
throw_m239339about 2 years ago
Starting a &quot;new react project&quot; should be basically creating an HTML file, and adding a script tag linking to React the JS library. Why are these developers always trying to obfuscate everything with tons and tons of layers of indirection all the time? You don&#x27;t need to &quot;bundle&quot; anything and certainly not use some server just to add Javascript to a page (unless it&#x27;s a matter of CSP of course) and you should certainly not have to rely on nodejs or cli tool X,Y,Z...<p>Somehow the JS&#x2F;Node dev community managed to re-invent JEE web profile, and is very close to re-invent Glassfish as well at that point, but worse because it didn&#x27;t learn anything from Java enterprise... this madness needs to stop.
评论 #35204464 未加载
评论 #35204257 未加载
评论 #35204248 未加载
评论 #35207160 未加载
评论 #35207545 未加载
CSDudeabout 2 years ago
All our application lives behind an authentication except login pages. I still cannot grasp how would I use Nextjs in only SPA mode. Not everything needs to be SSR, I don&#x27;t want to spare resources, just want to deploy it to S3, put cloudfront infront of it, let 404 requests return index.html and I can use the URLs without #.<p>SSR should not be a must the docs should reflect that. There is no way I&#x27;m paying Vercel 20$ per user for our simple use case or I&#x27;m hosting a VM to render pages. I don&#x27;t care about the improvements SSR would bring in the price of cost, deployment complexity, or any other complexity. Affecting React docs like this to push for SSR does not feel safe to me. I&#x27;m happy with my Vite based React TS project.
评论 #35222090 未加载
评论 #35232002 未加载
BiteCode_devabout 2 years ago
So after graphql, micro services, nosql and serverless, the SPA + &quot;libs not framework&quot; crowd join the &quot;woooops!&quot; club.<p>Ignoring the noise is really becoming a key skill to survive as a programmer.
评论 #35204484 未加载
评论 #35207143 未加载
评论 #35204808 未加载
评论 #35214156 未加载
评论 #35208826 未加载
dzogchenabout 2 years ago
If you want the control and low overhead of Vite but don&#x27;t want to implement everything a framework gives you, vite-plugin-ssr might be interesting for you.<p>It is basically Next.js as a do-one-thing-well Vite plugin (its slogan).<p><a href="https:&#x2F;&#x2F;vite-plugin-ssr.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;vite-plugin-ssr.com&#x2F;</a>
评论 #35218658 未加载
评论 #35204535 未加载
phendrenad2about 2 years ago
It sometimes seems like every web framework is run by people who see a minor problem and completely change their project to solve it. Flash back to 2014 when Rails made Turbolinks on by default, and broke everyone&#x27;s SPAs. Flash back to Angular rewriting in Dart because &quot;it&#x27;s the future&quot; (it wasn&#x27;t). Flash back to React replacing the perfectly-fine functional components with hooks (because Vue did it).<p>And now React is throwing away its backend-agnosticism because they want to hold your hand and make sure you don&#x27;t fail at SEO and blame React.
评论 #35219567 未加载
评论 #35231879 未加载
评论 #35231899 未加载
Xeoncrossabout 2 years ago
I&#x27;m still waiting for preact.js + htmx.org mashup. It probably exists somewhere, maybe <a href="https:&#x2F;&#x2F;docs.astro.build&#x2F;en&#x2F;concepts&#x2F;islands&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.astro.build&#x2F;en&#x2F;concepts&#x2F;islands&#x2F;</a> or something.<p>I just want a quick way to throw some react hooks or web components into a dom element using a library that is less than 1,000 lines of code.
评论 #35204457 未加载
评论 #35204479 未加载
ofrzetaabout 2 years ago
Those marketing pieces are becoming a bit tedious to decypher for me. The real message is not something about React SPAs but something about Wasp? Just tell me this thing about Wasp and don&#x27;t distract me with something about React.
moritzwarhierabout 2 years ago
Yes, for apps that are not hosted publicly or that are not mainly &quot;websites&quot; – what&#x27;s wrong with just using react + react-router? So I agree that this is an oversight.<p>Also, there surely are plenty of non-public web-apps in the B2B segment which run in the browser behind a login or on private networks, where SSR is basically unneeded (also, electron and the like)?<p>But:<p>for a public web site or commercial web app, I find the take from the first screenshot pretty nuanced.<p>It is easy to underestimate the complexity of building your own React SSR- or SSG-framework.<p>I recently tried out vite-plugin-ssr, which kind of does that, in a way that&#x27;s agnostic to the frontend framework&#x2F;library.<p>Can recommend it for people who want neither SPA without SSR nor one of the established React frameworks.<p>But for people who want to build a full, public-facing website with SSR (which is kind of a requirement for SEO), with minimal friction, I think the recommendation from the docs is absolutely correct, no?<p>Plain react for single components in otherwise non-React website, full-stack framework if you build the whole site&#x2F;app in React.
andrewstuartabout 2 years ago
I don’t want server side react.<p>It’s disappointing to me they’ve gone so hard on server side.<p>It feels like Facebook use it server side so they’ve lost interest in being purely client side.
评论 #35207873 未加载
评论 #35208122 未加载
jollyllamaabout 2 years ago
So they&#x27;re trying to corrupt the meaning of &quot;framework&quot; to mean only &quot;full stack framework&quot;
评论 #35202164 未加载
jonplackettabout 2 years ago
I think to sway the only benefit of Next.js is DEO is underselling how useful it is.<p>Sure SEO is important for most people anyway, but having multiple pages that load instantly rather than having to wait for a server call is also pretty handy. Plus auth working better.<p>I don’t see why next wouldn’t be the default and react now the outlier.
评论 #35208157 未加载
deepsunabout 2 years ago
I don&#x27;t understand the fuss about SSR, wasn&#x27;t that default way of doing websites 10+ years ago, before AJAX? E.g. Apache Struts has all of that Router logic since like 15 years ago, completely server-side.
评论 #35215542 未加载
PaulHouleabout 2 years ago
If you need SSR to support an SPA it calls into question why you need an SPA at all.
评论 #35222331 未加载
lerosabout 2 years ago
I just want to say, as a developer that just wants to get stuff done, I&#x27;m so annoyed by frameworks needing a meta framework, etc, etc. I want something as simple as CRA to be enough.
评论 #35204237 未加载
评论 #35204190 未加载
评论 #35237190 未加载
riidomabout 2 years ago
Wasp is a pretty interesting project. Actually waiting until they are not react-only (if that will ever happen).
评论 #35204565 未加载
apatheticonionabout 2 years ago
Integrating React into an MPA is quite awkward, surprised this is the target audience for it.<p>I love the potential of web development but of recent, it&#x27;s been infected by hype-marketing and blog-engineering.<p>I get that it&#x27;s become very accessible to write web applications and that&#x27;s good for the growth of the platform - but it almost feels like this accessibility has led it to squander its potential in pursuit of unsophisticated and unambitious objectives.<p>Web developers today are distracted by premature over-optimisations (ignoring effective low effort optimisations) and language+platform features that are a great, but kinda useless from a project development standpoint (time&#x2F;money&#x2F;complexity&#x2F;collaborative capacity cost).<p>As a result, platform developers are distracted implementing features that don&#x27;t innovate the platform - so we sit and wait for the truly groundbreaking things that never come because we gotta discuss the pipe operator, or adding types to the JavaScript language specification.<p>Meanwhile projects that can&#x27;t wait for the platform to evolve flood us with Electron apps that everyone hate.<p>I have hope, kinda...
lastangrymanabout 2 years ago
Obligatory &quot;front end is a mess&quot; comment. I taught at a bootcamp for 6 months, it was a great experience but when we moved on to react after vanilla JS the amount of incidental complexity was a huge step up, even with create-react-app. Now they push people towards adding a server side framework at the same time, right off the bat? I think there&#x27;s a real danger with new engineers entering the industry that they have no chance to develop a proper mental model of the underlying tech stack the way so many libraries, frameworks, packages, bundlers are thrown together just to get something working. You think the docs should just start with using plain React, and then branch off in to SPA Vs SSR later.
评论 #35207145 未加载
exabrialabout 2 years ago
We’ve switched to JSF with Primefaces and a lighter weight BootStrap component toolkit for internal apps.<p>Server Side Component Frameworks are probably peak developer productivity, at the small cost that they are not infinitely flexible.<p>Seems like a worthwhile tradeoff when building internal apps or database driven apps.
d_runs_farabout 2 years ago
Here&#x27;s my realm: We have a react based &quot;framework&quot; that in the end is zipped up and delivered as a SCORM package to be embedded in a Learning Management System. We use React Router to manage navigation.<p>After a quick scan of the Next docs, all references to routing seem to tie back to server side which is a non starter, as the SCORM is standalone HTML&#x2F;CSS&#x2F;JS&#x2F;Media - that we happen to embellish at run time with some api calls.<p>This is a case where the pure SPA with no server side is the only way to go; seems like a real pain to go against the default state of Next. Am I wrong and am just missing something? Again, been occasionally looking at next and the like over the past while, but never had time to really dig into into it.
评论 #35214179 未加载
评论 #35210467 未加载
88913527about 2 years ago
I don&#x27;t understand the pivot back to SSR. Tearing down and standing up the entire DOM and page memory between navigations is just unnecessary work. Little things like maintaining scroll position in the page&#x27;s navigation bar meaningfully improve usability and are only achievable with a SPA-based approach. This doesn&#x27;t discount the challenges of building SPAs: bundle sizes, performance, etc. can be concerns if not managed. That&#x27;s true of any application.
评论 #35204332 未加载
评论 #35204759 未加载
评论 #35204358 未加载
评论 #35204328 未加载
评论 #35204335 未加载
评论 #35204505 未加载
评论 #35204807 未加载
评论 #35204706 未加载
NerdiOrgabout 2 years ago
I think the author is mistaken. You can build a PWA, SPA in Next.js and it&#x27;s even easier than not using it.<p>I feel like the author is just confused that they&#x27;re not specifically focusing on SPA because whether anyone wants to admit or not, enterprise companies aren&#x27;t asking for SPA, or mobile apps, they&#x27;re asking for headless, static websites. It makes sense that React would respond to those market demands.
评论 #35218993 未加载
eschatonabout 2 years ago
But… they don’t, really. “SPAs” are just a corruption of the web brought about by people who obsess over replacing end user operating systems with HTML+CSS+JavaScript. Most actual users would be just as happy to install a real native application.
评论 #35238622 未加载
评论 #35237088 未加载
fabian2kabout 2 years ago
As far as I understand you can use these frameworks to write SPAs as well. I have no idea how well supported that use case is in the end.<p>I find the idea that you want to handle data fetching and routing in a framework to be reasonably convincing. There are advantages here, and it&#x27;s easy to get into a bit of a mess if you just fetch data in each component.<p>The part that has stopped me from looking at the frameworks until now is that they add a lot of parts I don&#x27;t need, and the documentation seems to be focused on the SSR part. And then there are React server side components, which is another new concept I need to understand. Maybe the frameworks are a good fit for my SPA use cases, but it&#x27;ll take quite a bit of time to find out if that is true.
评论 #35204194 未加载
dwaltripabout 2 years ago
Interesting that CRA isn’t mentioned anymore.<p>Someone opened an issue to discuss this:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;create-react-app&#x2F;issues&#x2F;13072">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;create-react-app&#x2F;issues&#x2F;13072</a>
评论 #35237254 未加载
say_it_as_it_isabout 2 years ago
&gt;Next.js is a great framework, and its rise in popularity is due in a large part to the return of SEO optimization via Server-Side-Rendering (SSR) within the collective developer conscience.<p>I stopped reading here because the article may have been made by ChatGPT
weird-eye-issueabout 2 years ago
You can use NextJS to build a SPA so the entire premise is invalid.
yellowappleabout 2 years ago
Was React not already a framework? Are SPAs that use frameworks not SPAs? What even is a framework or SPA anymore?<p>This shit is why I stick to the backend.
评论 #35227364 未加载
randomopiningabout 2 years ago
Isn’t it going to get to a point where servers and avg connections are so fast that server side rendering makes sense again?
评论 #35216675 未加载
synergy20about 2 years ago
sveltekit is the same, ssr first, i am so sad react now becomes ssr first too, i am forced back to vue,which still has a CSR SPA first, add ssr if you need it approach.<p>no i dont need ssr at all, internal tools,dashboards,embedded devices,etc etc have nothing to do with ssr,nothing at all
charcircuitabout 2 years ago
This article makes the mistake of thinking SPA and SSR are mutually exclusive or opposites.<p>SNR benefits SPAs too.
robertoandredabout 2 years ago
I don’t think the author understands what a SPA is.
评论 #35212572 未加载
ecfabout 2 years ago
Hype driven developers&#x2F;marketers believe the only type of websites that exists are those which need indexable content for SEO purposes. More news at 11
评论 #35227741 未加载
评论 #35204170 未加载
评论 #35204644 未加载
colechristensenabout 2 years ago
What should I use to create a new SPA for a new project these days?