This is a limitiation from React. 
Authors said "We're investigating ways to return more than one node but we 
don't have a solution yet." 2013/12

In my use cases, I rarely have to add a dummy wrapping div or span. It always 
end up with a css class or click handler 

On Friday, July 18, 2014 5:33:56 AM UTC+2, Udayakumar Rayala wrote:
> Hi,
> 
> Can I return an array of html elements from an om/component? 
> 
> (defn widget [app-state]
>   (om/component
>    (html
>     [:div.class1]
>     [:div.class1])))
> 
> (om/root widget
>              app-state
>              {:target (first (. js/document (getElementsByTagName 
> "main")))})))
> 
> I see the below error when I try to return multiple html nodes.
> 
> Uncaught Error: Invariant Violation: ReactCompositeComponent.render(): A 
> valid ReactComponent must be returned. You may have returned undefined, an 
> array or some other invalid object. 
> 
> I can wrap those multiple nodes in another :div but would like to avoid 
> unnecessary html tags if possible. 
> 
> Thanks,
> Uday,

-- 
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