Replies: 3 comments 2 replies
-
I think that doc is under construction. Please see README.md: https://github.com/pmndrs/zustand#using-subscribe-with-selector You are very welcome to contribute to fix the docs. |
Beta Was this translation helpful? Give feedback.
-
@guenyoo Please join this thread #1033 (comment) and say you want to contribute. I hope @chrisk-7777 can assist you. |
Beta Was this translation helpful? Give feedback.
-
Thanks @guenyoo ! I've @ 'ed you over on the main discussion thread about docs. |
Beta Was this translation helpful? Give feedback.
-
Hey folks,
I like Zustand a lot and would actually need to use it in between React and VanillaJS, however I'm running into problems. Am I using it incorrectly or is something not working correctly?
I'm referencing to this part of the documentation:
Reading/writing state and reacting to changes outside of components
I've also created a codesandbox to illustrate the problem:
It's very basic:
What I'm expecting to happen is that only the changes to state.paw are going to be logged to the console, so basically two logs. One initial and one after it's set to false.
What's actually happening is that I get three logs because I'm getting the state logged when fur changes, too.
In your docs it's a similar example:
Here's a console screenshot:
![image](https://user-images.githubusercontent.com/15145968/197197669-94824649-e732-4e5c-8e24-f64952e6349b.png)
However, that example also fails. And what's also failing in your docs is copying the whole segment and running it in a sandbox because of the use of shallow variable and not importing create first. I get that this second point is a bit nitpicky maybe but it would be neat to copy a block of code without running into errors first.
Beta Was this translation helpful? Give feedback.
All reactions