There seems to be a problem with using multimethods (and presumably protocols) 
as the function passed to build.

In particular, lifecycle methods will not be properly invoked after the initial 
render.

The cause of the problem is that build identifies the "component type" as the 
function passed to build (as I understand it)

In my case, I want to use a generic multimethod to map my data to specific 
components:

(defmulti make (fn [x & args] (:tag x)))

(defmethod make :component1 [x & args] (reify ....))
(defmethod make :component2 [x & args] (reify ....))

etc

The result is that both component1 and component2 will end up with the same 
component type. Which means that if I swap component1 with component2 in my 
app-state, render will be called but mount and unmount will not be, because 
React will think it was the same component.

My workaround is to set! .-constructor of the object returned from build, but 
this is pretty ugly and requires additional bookkeeping, like creating unique 
objects to correspond to the tags.

Is there a better way to do this?


-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to