News for hackers. Stuff that matters.
Re:New React docs pretend SPAs don't exist anymore by CSDude on Sunday March 19, 2023 @03:15AM (#35216762)
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'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 #.

SSR should not be a must the docs should reflect that. There is no way I'm paying Vercel 20$ per user for our simple use case or I'm hosting a VM to render pages. I don'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'm happy with my Vite based React TS project.

Re:New React docs pretend SPAs don't exist anymore by synergy20 on Sunday March 19, 2023 @02:38PM (#35222090)
cant agree more, vercel likes ssr,and it now owns nextjs and svelte,then it forces ssr on the community,it is basically leveraging open source for its own business needs solely, which will not last long if they keep doing this down the road. disappointed.
Re:New React docs pretend SPAs don't exist anymore by leerob on Sunday March 19, 2023 @02:45PM (#35222148)
You can use Next.js in SPA mode – you don't have to use SSR. Here are the current docs (https://nextjs.org/docs/advanced-features/static-html-export) and we're working on an improved version for the new App Router (https://beta.nextjs.org/docs/configuring/static-export) based on community feedback. With this export, can you deploy anywhere you prefer.
Re:New React docs pretend SPAs don't exist anymore by synergy20 on Sunday March 19, 2023 @07:25PM (#35224908)
this is still the ssr-first-but-will-do-it-all, I read the docs along with svletekit(which by the way, is the same tone, saying sveltekit does both SSR and CSR).

it is NOT, I do not need wade through all those unnecessary SSR code and doc and steps and some second-class-citizen configurations to figure out how to get a CSR out of it. CSR users are not that dumb.

It seems to me Vercel is the only one pushing for SSR-for-everything, I switched from svelte to React for exactly that reason, now React/Next.js is selling the same thing, I'm back to Vue. Please do not ever buy-or-influence Vuejs for SSR-first-and-does-everything-you-need, at least leave one untouched for us who cares nothing about SEOs.

Re:New React docs pretend SPAs don't exist anymore by cush on Monday March 20, 2023 @10:30AM (#35232002)
I never understood where the idea came from that if pages are authenticated, then SSR isn't needed. Maybe because people think the only benefit is SEO. The biggest benefit is performance. SSR is still great to have behind authenticated pages, to improve load times. eg multiple tabs, continuing sessions, etc. There are countless examples of sites that usr SSR + CSR + Auth - Netflix, Github...
Re:New React docs pretend SPAs don't exist anymore by psnehanshu on Monday March 20, 2023 @02:59PM (#35236812)
The only other benifit of Next.js other than SEO is the project architecture that it provides.

If you are building web apps that live behind auth, it's a no brainer to use CSR. It's easy to deploy, cheaper to host and serve, not harder than SSR to develop. The cons about performance can be solved using code splitting. Moreover with proper caching, the app loads instantly.

Are there new age alternative CRA that provides a scalable project architecture like Next.js provides. Maybe it can come with basic libraries like react-router, react-query, pre installed and Vite pre configured.

Re:New React docs pretend SPAs don't exist anymore by cush on Monday March 20, 2023 @08:35PM (#35240950)
Of course, there are tradeoffs. Code splitting might help a bit for someone with a slow connection, but I wouldn't say it "solves" the problem like truly streaming content does.
Re:New React docs pretend SPAs don't exist anymore by psnehanshu on Tuesday March 21, 2023 @12:03AM (#35242412)
Yeah, it's like a trade off. You can't have your cake and eat it too. With CSR, you distribute the load of rendering to your clients, which reduces your cost, which in turn allows you to provide better service.