Fork me on GitHub
#reagent
<
2019-05-16
>
samedhi16:05:09

I have the following,

(reagent/create-class
     {:should-component-update
      (fn [this old new]
        (println "should-component-update" old new)
        false)
      :reagent-render
      (fn [_]
        (println "reagent-render")
        [component])})
I see reagent-render as I make changes to an input field in component, but I do not see should-component-update firing ever...

samedhi16:05:24

My understanding is that should-component-update should fire before reagent-render is called.

samedhi16:05:25

Hmm, something must be wrong with my metaphor, the subscription I create in a outer let binding is derefed (not shown here) in component... How could :should-component-update's function be aware of a derefed subscrition value in :reagent-render's function?

samedhi16:05:19

apologies, now I am mixing my re-frame and my reagent problems. 🙂

lilactown16:05:55

I believe reagent calls forceUpdate when it reacts to a ratom change, which would route around :should-component-update

theeternalpulse22:05:17

are hooks integrated with reagent fully?

lilactown22:05:17

no, you cannot use hooks in reagent components right now

lilactown23:05:01

there are several other libraries that have integrated with hooks, if you’re interested in trying them out