You have to understand clearly the contexts, at this point in your app redux seems to be client-only, so it makes no sense to use it server-side.
There is currently no equivalent to React Context server-side, Next uses AsyncLocalStorage from Node.js instead for use cases such as carrying the request around (which is some kinds of context)
If this feels blurry it's normal, I am writing a paper on this subject to be released early next year and other devs are discovering Next.js implementation, expect more ressources soon)
#[closed]
8 messages · Page 1 of 1 (latest)
anyway, if you really really need your Redux state to render non interactive components server-side, you have to pass those data via a cookie, and read them from cookies() during SSR
this is an advanced optimization, your probably don't want that
so instead
you can fetch data in pages, as usual, feed a React context with the fetched data, and use "use client" everywhere. That's perfectly fine. See my work here: https://github.com/Devographics/Monorepo/tree/feature/next-13-react-18/surveyform/src/app/[lang]
note about "then the entire app is client rendered. " => no, "use client" means it's still prerendered server-side
your app will be "interactive", not pure client. I've also commented the beta doc about that, currently I find it a bit unclear
- RSC = not interactive, sevrer-rendered, not rehydrated client-side (think just HTML, pure server)
- use client = interactive, server-rendered, client rehydrated (think HTML + JS, SSR friendly)
- dynamic/client-only = interactive, client-rendered (think pure JS, browser-only)