This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-09
Channels
- # announcements (4)
- # babashka (25)
- # beginners (11)
- # calva (32)
- # clj-kondo (5)
- # clojure (130)
- # clojure-dev (11)
- # clojure-europe (17)
- # clojure-nl (1)
- # clojure-norway (96)
- # clojure-spec (1)
- # clojure-uk (3)
- # clojurescript (9)
- # conjure (2)
- # cursive (8)
- # datalevin (1)
- # etaoin (14)
- # ghostwheel (2)
- # hyperfiddle (13)
- # joker (2)
- # leiningen (82)
- # malli (3)
- # pathom (4)
- # polylith (12)
- # releases (3)
- # spacemacs (7)
- # sql (3)
Why do we need an r/atom
when a Reagent component, to my understanding, only changes when its internal state and/or props are different than before?
r/atom
is the mechanism by which a reagent component changes when that state changes
So if we use a plain old Clojure atom, it wouldn't count as a state change?
it’s state that would change. But the react component wouldn’t care. same as if you printed to the console. state has changed, but who cares
So just to confirm further, if the regular Clojure atom was 0
and we keep incrementing it, it wouldn't change a thing (assuming props don't change in the component)
So r/atom
is basically a plain old Clojure atom with an event listener for the state change and the callback being to render the component again