Fork me on GitHub
#cljsrn
<
2019-10-31
>
vikeri07:10:40

Yeah exactly! We have generalized it into a pattern we call observers.

vikeri07:10:37

It's extremely useful given that you won't have to catch changes in the handler but instead you can just rely on re-frame doing it's magic

vikeri07:10:29

We did the syntax a little differently but same concept

Oliver George10:10:37

Out of curiosity, do you ever set your hair on fire with it? e.g. observer dispatches, event handler updates state, state change triggers same observer... rinse later repeat

vikeri10:10:08

Haha actually no, what triggers the observer is usually decoupled from what the observer does (eg. updated network state fetches data from API). We tend to observe mostly things like network state, db loaded, app in foreground etc and those we rarely update ourselves.

👍 4