Using store ouside components discard a config variable #2106
Unanswered
0xmemorygrinder
asked this question in
Bug report
Replies: 1 comment 18 replies
-
|
@0xmemorygrinder would you mind sharing us a codesandbox demo? Just a minimal repto I would like to help you |
Beta Was this translation helpful? Give feedback.
18 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I am using zustand for a frontend project that needs to be generic and only rely on its config variables defined in the project.
Here is a sample config variable I use :
When I create a slice of my store, I use this config to create my state data.
I then create my store with all the slices that compose it.
Everything works fine when using the store inside next components. However, I need to access and mutate the state ouside of react components (which is normally supported.
I get an error when accessing the state by using
At this point, the error tells me that the config passed to Object.entries during my store creation is undefined. I logged the value and it really is.
How can I fix this ?
Thanks for your time.
Beta Was this translation helpful? Give feedback.
All reactions