Next.js Discord

Discord Forum

Mutable global state for server compnents?

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
How do I create a mutable global state for server compnents? Like useContext but for server components.
Answered by aardani
You could simply just export the variables and the mutators
View full answer

4 Replies

You could simply just export the variables and the mutators
Answer
do note that the component's state only live per request and wont persists in between user requests
Asiatic LionOP
Too easy, thanks bro!
@aardani You could simply just export the variables and the mutators
Hi Alfonsus, please do you mind elaborating on this. I'm not sure I quite get it. I think you're answering the question I just asked (link below). But I'm not sure I quite understand your solution.

https://nextjs-forum.com/post/1174062259983614093