Replies: 1 comment 3 replies
-
|
If it's TS only issue, you can assert type. const snap = useSnapshot(state) as typeof state;See also: Lines 51 to 64 in 86de4ec |
Beta Was this translation helpful? Give feedback.
3 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.
-
Good day, and thanks for the amazing library!
I have a question: when we pass any state into
useSnapshot, it converts all types to readonly. As a result, libraries likeslate-reactorframer-motionstart complaining about this readonly behavior.What’s the best way to handle this? Obviously, we can work around it using
deep-clone, but what would be the optimal approach?Previously, when we worked with Zustand, we could simply extract something from the state and freely pass it into any components without any issues. Now, we have to find a way to coexist with readonly.
Beta Was this translation helpful? Give feedback.
All reactions