Next.js Discord

Discord Forum

Proper State Management

Unanswered
StilauGamer posted this in #help-forum
Open in Discord
Avatar
Hey,
So I am currently working on a new project and I've hit quite confusion when it comes to state management in NextJS.


Working with CSR React and Nuxt in Vue, etc its quite easy to work with states.
But in NextJS, I find it rather.. unexplained / undocumented; I might be wrong, but I'd love to be sent on the right path! 🙂
I am mostly thinking cross component states 🤓

12 Replies

Avatar
Blanc de Hotot
What do you mean by state management
And what type of state across components, what does react query or swr not give you
Avatar
I want to be able to share states across different components..
Some simple data, but I am not too experienced with SSR and NextJS..

So I am wondering how I can do this quite easily, I looked into Zustand, but is there any way to hold data on the server side and be able to get data on server side, etc?


I've never worked with either React Query ( Not sure if you are refering to Tanstack Query tho, I've worked with that ) or SWR.
Avatar
no @StilauGamer
when it comes to the server, it's stateless
so when we talk about state management, it's all on the client side
if you want to share some data between server and client
use query params
also what kind of data do you want to hold on the server side? to get that again on the server side?
Avatar
@StilauGamer any other concerns?
Avatar
Blanc de Hotot
@James4u (Tag me if needed) sounds like he wants a databae
The more I'm thinking about ut