Hi, I asked this before and the short answer is *not* by passing in realised components in another another component's state as you have done (which was almost my first attempt).
The consensus was to use multi-methods. If you can't then you pass the child state and the child fn through to the container which then invokes (om/build child-fn child-state). https://groups.google.com/d/msg/clojurescript/6HfwarWsFfI/lvRbRFAeiV0J has a lot more detail. On 19 March 2015 at 11:53, Wilker <[email protected]> wrote: > Hi, > > I'm creating a component here that will actually render on canvas, to be > more specific I wanna have a tree definition that end's up rendering on > Canvas (kind of the react-canvas project, but on Om, and for other > purposes). > > In React is more clear how to write things like this, you can do: > > <Surface> > <Layer> > <Rectangle width="100" height="100" /> > </Layer> > </Surface> > > And on react you have the children props and that stuff that can be use to > "integrate" those components. > > But how do I accomplish a similar thing with Om? > > The farthest that I was able to got was an idea like this: > > (om/build surface > [(om/build layer [(om/build square {:width 100 :height 100}]]) > > This is just an "idea" on how to nest components that I came up, but it's > not really working... > > Ideally I would like for the child node to be able to access the parent in > order to call methods on the canvas (that's on the surface component) to > render things. > > How can I manage this kind of components with Om? > > Thanks. > > -- > 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.
