Next.js Discord

Discord Forum

Server-side rendered dashboard

Unanswered
American Crocodile posted this in #help-forum
Open in Discord
American CrocodileOP
Hi,

I think I have a typical use case of SSR (server-side rendering), CSR (client-side rendering) components that I would like to tackle with you.

I'd like to have this

- P1: ParentServerComponent
- C1: YearSelectorCSR (Output = year)
- C2: DashboardSSR (Input = year)

I think it's key that C2 is SSR, since it needs to load plenty of data and I don't want it to be sent raw to the client, and it would be way more efficient to have it rendered on the server since they are plots and stuff like that.

I can't manage to get the output of C1 to C2. How to do this?

7 Replies

American CrocodileOP
Would that be a good idea to put the year in query params then do ssr on C2 ?
American CrocodileOP
Ok. Is there a classical alternative ? I guess it's a common use case for mixes between CSR & SSR
@American Crocodile Ok. Is there a classical alternative ? I guess it's a common use case for mixes between CSR & SSR
you are trying to send data from client-side states to the server. so you have to put the data where the server can read: the URL (e.g. pathname, query params) and headers (e.g. cookies)
American CrocodileOP
It makes sense indeed
though for your case, depending on the (size of the) data that the server component might return, i would potentially prefer just returning all the data to the client and do the filtering on the client
American CrocodileOP
There is not much data. It's just that I'm facing an app where most of the time I do CSR, and I think that's a pity to not leverage NextJS CSR capabilities when it can be done. But maybe it's just not fit for my use case