Next.js Discord

Discord Forum

server components - client component cross state management (zustand)

Unanswered
Kokoni posted this in #help-forum
Open in Discord
Avatar
KokoniOP
Hi community! Can anybody explain to me how this is working?

I'm trying hard to understand how state management can work in this new paradigm.

both my layout and my page on route employee/[id] are server components.
my layout file makes a fetch call and setsState to a zustand store server-wise.
my page file renders a EmployeeView component thats also a server component. my Employee view can read such state correctly server-wise but my page file (which imports and uses it) can't.

how the heck is it working????!! weird logic

here's the code https://github.com/sebastian-agonzalez/employee-abm/tree/state-management
Image

0 Replies