Reagent/track not updating

I’m learning to use things like track, wrap, cursor, and reaction in Reagent. I’m a little confused about the following behavior:

(def aa (reagent.core/atom [2 44]))
=> #'cljs.user/aa
(def bb (reagent.core/track + (@aa 0) 3))
=> #'cljs.user/bb
@bb
=> 5
(swap! aa assoc 0 5)
=> [5 44]
@bb
=> 5

I’m wondering why bb remains the same when the entry in aa it should be tracking changes.

It appears (reagent.core/track #(+ (@aa 0) 3)) works. I guess I had understood the documentation incorrectly. I wish there were more examples extant.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.