News for hackers. Stuff that matters.
Re:Next.js 12 by leotaku on Tuesday October 26, 2021 @01:41PM (#29003520)
I'm personally curious how the Next is able to achieve the claim of "zero client-side JavaScript" mentioned here[1] using react server components? It just doesn't seem to make sense to me, and the HN clone example and my barebones test project also clearly still load about 74.2 KB of JavaScript. Is the claim supposed to mean that the server components won't require additional JS, or maybe that they won't need to execute any client-side JS to be fully rendered?

[1]: https://nextjs.org/docs/advanced-features/react-18#react-ser...

Re:Next.js 12 by krall12 on Tuesday October 26, 2021 @02:36PM (#29004388)
I think it means that any page that only renders server components can just push the built html to the browser. If there were to be client components, like an upvote button, react would be required for that to hydrate the DOM.

It’s very similar to what Astro is doing. Only adding the JS if it’s actually necessary.

Re:Next.js 12 by robertrbairdii on Tuesday October 26, 2021 @02:22PM (#29004179)
From my understanding from watching the keynote earlier today, the reason that demo has JS is that repo opted in to have client side code to handle the upvote functionality. If it didn't require that interactivity it could be shipped with no client side JS. The client side js code is defined in the component files ending in .client.js

https://github.com/vercel/next-rsc-demo/tree/main/components

Re:Next.js 12 by leerob on Tuesday October 26, 2021 @02:39PM (#29004426)
You can read more here on the original RSC announcement: https://reactjs.org/blog/2020/12/21/data-fetching-with-react.... RSC are still experimental, and as mentioned, this demo has some client-side functionality (upvotes).
Re:Next.js 12 by leotaku on Tuesday October 26, 2021 @03:47PM (#29005361)
Thank you for your response! However, the linked content further seems to support my suspicion that having websites without any client-side JS is not in the scope of RSCs. The linked RFC, in my opinion, clearly states for it to be expected that a client-side framework and React accept and handle the streamed React response[1]. So while it may be possible to eliminate a lot of client-side JS, at least those would always have to be available on the client, correct?

I would also like to make it understood that I'm not here to bash the Next project, I am simply interested in the technology.

[1]: https://github.com/josephsavona/rfcs/blob/server-components/...

Re:Next.js 12 by agrunyan on Tuesday October 26, 2021 @01:43PM (#29003552)
Seems he missed your question, which I’m also curious about.
Re:Next.js 12 by e12e on Tuesday October 26, 2021 @05:00PM (#29006198)
I would assume "no client side js" means "works fine in w3m". I'm guessing that's not the case?
Re:Next.js 12 by k__ on Tuesday October 26, 2021 @02:30PM (#29004288)
Also, does "no client-side JS" also work with Cloudflare Workers?