Fork me on GitHub
M J11:02:47

Hello, I want to change an atom only when another atom changes value, ho wdo I do that? For example, I have a value

(let [button-disabled? (r/atom true)])
I also have children that are
(let [email-button-disabled? (r/atom true)
      number-button-disabled? (r/atom true)])
When one of them turns false, I want to change the main one.

M J13:02:18

Thanks! 🙏


it looks like those are not normal Clojure atoms but atoms from reagent library. if that is the case then look at reactions provided by reagent


also there is #C0620C0C8 channel

Sam Ritchie16:02:15

Add-watch will work too I believe! But reactions are nice of course