Best practices question: Grouping atoms without unneccessary renders #676
Replies: 1 comment 1 reply
-
Valtio optimizes re-renders with state usage (=property access). I think you just want to use atoms for each field (it's jotai's best practice), but if you really want to do something like valtio, here's one example: |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
While evaluating different state management libraries for our React Native project, one requirement is to be able to access related atoms through a common hook, without an update to "field B" causing a component which only uses field "A" to re-render.
Working example in Valtio
Non-working example in Jotai
Is there any way around this? I love the Jotai design, but don't want to lose out on keeping things nicely grouped when needed.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions