Yeah, I really wasn't kidding about that newbie warning :). Data isn't defined
anywhere. Doh.
Everything is a lesson and this lesson is that you can reference undefined vars
(or more accurately self-defining vars I guess). Long live JavaScript :).
On Thursday, 30 October 2014 17:04:29 UTC, Jonas Enlund wrote:
> On Thursday, October 30, 2014 6:57:43 PM UTC+2, Colin Yates wrote:
> > (newbie warning!)
> > I have a component which takes the app-state and renders it beautifully
> > (for example a table of contacts) - great.
> >
> > [code]
> > (defn mount-om []
> > (om/root
> > original-component
> > app-state
> > {:target (. js/document (getElementById "my-app"))}))
> > [/code]
> >
> > Now I create a "wrapper" component of the form:
> >
> > [code]
> > (defn wrapper [app owner]
> > (reify
> > om/IRender
> > (render [_]
> > (om/build original-component data))))
> >
> > (defn mount-om []
> > (om/root
> > wrapper
> > app-state
> > {:target (. js/document (getElementById "my-app"))}))
> > [/code]
> >
> > And I can see the table my original component produces but it is empty.
> > original-component is treating its data as a map so it is simply
> > (om/build-all (dom/li ...) (:contacts data)).
> >
> > I can create a trivially simple project on github if that isn't clear?
> >
> > I don't understand how simply wrapping it in a component can change the
> > nature of the cursor that original-component sees? I have almost certainly
> > missed something here :).
>
> Should (om/build original-component data) be (om/build original-component
> app)? I can't see where `data` is defined.
--
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.