I haven't reviewed the ominate code in a while so would need to look at it again. Check the branch, however, as it was slightly more up to date. As for unmounting and remounting, that used to be a bug yes but AFAIK this is no longer the case (since the multimethods fix)
On Mon, 17 Nov 2014 13:00 Jonas Enlund <[email protected]> wrote: > Please correct me if I'm wrong but wouldn't `(ominate ...)` mount a new > component everytime its parent is rendered? It's my understanding that Om > (and React?) does not really support anonymous components. Here's the > implementation for reference: > > https://github.com/danielytics/ominate/blob/master/src/ominate/core.cljs# > L38-L79 > > On Monday, November 17, 2014 2:47:36 PM UTC+2, Colin Yates wrote: > > An alternative (from https://github.com/danielytics/ominate) is for the > outer component to not actually be a component but be a factory (i.e. so it > returns a function which returns the om component) which takes in the > nested component as a symbol. > > > > This has the slight downside that the factory must pass on the :opts > (for example) to the nested component. > > > > On Monday, 17 November 2014 11:49:31 UTC, Colin Yates wrote: > > > Hi all, > > > > > > I keep running into the really common use case (and seeing others > running into as well) of composing components. > > > > > > Quite simply, how is one supposed to compose components in om? > > > > > > In my particular use case I have a Header component which displays a > title and optionally a component describing a summary of what is being seen > (which is more than simple text). I want to do something like: > > > > > > (defn header [data owner] > > > (reify > > > om/IRender > > > (render [_] > > > (dom/div ..... > > > (when optional-component) optional-component))))) > > > > > > It works if I put the component into either the header state or opts > (e.g. > > > (header data owner {:opts {:optional-component (om/build ...}})) > > > > > > but neither feel idiomatic. If I had to chose the lesser of two evils > I would chose :opts I guess. > > > > > > I did consider multi-methods, but this didn't feel particularly nice > either. > > > > > > What am I missing as this doesn't seem to be an obscure use-case :)? > > -- > 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. > -- 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.
