Replies: 1 comment 2 replies
-
Have you looked into |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to subscribe on a proxy object in React and have the proxy returned as a result instead of a snapshot?
So far, I came up with the following workaround:
That does the trick by it's not render optimized. For instance, changing
proxy.foo
will produce re-render in the component which is only usingproxy.bar
.Any other options/workarounds on how to achieve this?
Why we need this
We have ORM model instances which are in fact both Valtio proxies (when changing data) and snapshots (when reading). The model has methods that allow modifying its state. Here's the simplified code of how we use it:
Beta Was this translation helpful? Give feedback.
All reactions