Skip to content

How best to persist state between client renders, e.g. appContext #705

Discussion options

You must be logged in to vote

Usually folks use state management tools such as Pinia for Vue, and for React Redux or its many alternatives.

These tools handle the global client-side state on the user's behalf. But, if you wish to handle your global state manually yourself, then there is nothing wrong with using the global scope window – just make sure to use a unique prefix such as window.__my_global_scope.someGlobalData to avoid conflicts with libraries and browser extensions. (You can also use a Symbol() to avoid conflict with certainty.)

Let me know if that answers your question. I'm glad you're enjoying VPS.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jahredhope
Comment options

@brillout
Comment options

@brillout
Comment options

Answer selected by jahredhope
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants