-
I'm new to Jotai, apologies if this is a basic question. When using an atom in a component I'm getting differing values inside and outside of the onChange function. The value outside the function updates with the slider, but inside the function doesn't. This is using Next JS if that makes any difference. |
Beta Was this translation helpful? Give feedback.
Answered by
Thisen
Jan 12, 2022
Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
hammo92
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useAtom
works similarly touseState
. It's asynchronous and therefore state won't be changed until the next render. This means you can't expect to get the state value, right after you've set it.