I have this same problem. I thought multimethods would be great way to render 
different views in simple page app, so I wrote something like this:

  (def app-state {:view :login})

  (defmulti render-view (fn [app owner] (:view app)))

  (defmethod render-view :login [app owner]
    (om/component
      ...

  (defmethod render-view :foo [app owner]
    (om/component
      ...
  
  (om/root
      render-view
      app-state
      {:target (js/document.getElementById "app")})

This works, except that the local state does not work. I guess this is same 
problem Feng describes?

What would be a work around? Shoud I just have a something like this:

  (om/root
    (fn [app owner]
      (condp = (:view app)
        :login (login-view app)
        ...one line for each view..

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to