strangely my component-lifecycle functions are not called when I define a component as a function with the hooks as meta-data (the example is as easy as that - like in the examples I saw around).
(defn my-callback [this] (println (.-innerHTML (reagent/dom-node this))))
(defn inner-compo []
[:p "content"])
(defn my-compo []
(with-meta inner-compo
{ :component-did-mount my-callback })
)
When I create the component with reagent/create-class
it works fine. I'm using the Reagent 0.6.1
.
Solution found: you need to define the component as a Var instead of a function:
(def my-compo
(with-meta inner-compo
{ :component-did-mount my-callback })
)
then it works fine - really odd.
If anyone could explain why?
regards, fricke