-
const a = atom((get) => {
return get(b)
})
const b = atom((get) => {
return get(a)
}) A more real world example would be: const valueAtom = atom(0)
const effectAtom = atomEffect((get) => {
console.log('derived is now', get(derivedAtom))
})
const derivedAtom = atom((get) => {
get(effectAtom) // mount effect
return get(valueAtom)
}) |
Beta Was this translation helpful? Give feedback.
Answered by
dai-shi
Nov 17, 2024
Replies: 1 comment 1 reply
-
I don't think we should support it. It's mathematically wrong, or undefined, right? I think it's reasonable for |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dmaskasky
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think we should support it. It's mathematically wrong, or undefined, right?
I think the cycles would cause infinite loops, or should error with cycle / infinite loop detection.
I think it's reasonable for
atomEffect
to have its own workaround as effect can be imperative instead of declarative.