Fork me on GitHub
#reagent
<
2022-12-15
>
Yuhri Graziano Bernardes01:12:49

Hi everyone \o How can I do this in Reagent? I've tried the adapt-react-class functions and the [:> MyComponent ...] in parameters... but both has failed...

Yuhri Graziano Bernardes01:12:10

Okay, I've just figured out. The create-element did the trick \o

Sam Ritchie16:12:00

hey all - is there a predicate to check if an atom is a ratom??

Sam Ritchie16:12:11

beyond checking the type with instance?

Sam Ritchie16:12:57

one more Q… if I am reading a reagent state inside of an animation loop, where i DON’T want a re-render triggered in the component holding the loop, is this the preferred way to do a “sneaky read” of a ratom? https://clojurians.slack.com/archives/C0620C0C8/p1669207172826729?thread_ts=1669206982.672919&amp;cid=C0620C0C8

dvingo19:12:13

you can use (.-state my-ratom)

Sam Ritchie20:12:13

nice!!! looks like if I do that it will work on cljs atoms as well. Thanks @U051V5LLP

Sam Ritchie20:12:15

and I see the answer to my other question too: (satisfies? IReactiveAtom src)

dvingo20:12:55

sure thing 🙂

Sam Ritchie18:12:36

(also not sure what the performance cost is to running that binding call in a hot loop, maybe not much? reading the atom at all is obviously a cost, probably not much delta over that)