-
Inside of components, we'll do: What if we want to do the same, but outside of a react component? For example, how can this be done from inside a store like Redux or Zustand? In my case, I have a zustand store in which I'm orchestrating complex animations. I'd like to be able to initialize and modify shared values directly in the store, so I can continue to have dumb, modular components. I hear there is makeMutable, but I can't find anything official on it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey! If you want to initialize the shared value outside of the component, you can use the It is not documented yet and it is generally not recommended to use Example code: const globalSharedValue = makeMutable(0); |
Beta Was this translation helpful? Give feedback.
Hey!
If you want to initialize the shared value outside of the component, you can use the
makeMutable
function that is used internally by theuseSharedValue
hook.It is not documented yet and it is generally not recommended to use
makeMutable
as it's API may change over time between reanimated versions but it is the only way to suit your needs.Example code: