Replies: 1 comment
-
This is a tricky one.
Well, it depends. To my understanding, usually people who pick Valtio like its mutable syntax which Jotai can't do. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
mix-use of useState and valtio.derive will make the component read the stale value of the derived proxy.
Link to reproduction
https://codesandbox.io/s/valtio-mix-with-state-ielduu?file=/src/App.tsx
Though this example seems harmless, this inconsistency brokes my project (in the progress of migration from redux to valtio).
but it works fine if use valtio only, https://codesandbox.io/s/valtio-not-mix-with-state-2j4ocl?file=/src/App.tsx
BTW, I've tested jotai, it also works, https://codesandbox.io/s/brave-drake-qsvvz5?file=/src/App.tsx, would you suggest using jotai instead?
Beta Was this translation helpful? Give feedback.
All reactions