Fork me on GitHub
#om
<
2015-08-15
>
Jakub Holý (HolyJak)18:08:20

Hello, could anybody be so kind and advice me regarding including a JS React component in an Om application? My problem is that I essentially need this order of scripts in the HTML: 1. React 2. json-inspector, the component in question, which depends on React 3. My Om/cljs code , which wants to use the component However React is compiled into and included in my cljs sources. Is there any solution for this? Thanks!

Jakub Holý (HolyJak)18:08:12

Here is what I have and what enables me to instantiate the JS component - but it is not possible to do so from the cljs sources (the commented out code in core): https://gist.github.com/jakubholynet/03c78452302dedfae760

Jakub Holý (HolyJak)21:08:50

Another question: Any idea why does the following code trigger the React warning “Don't set .props.children of the React component. Instead, specify the correct value when initially creating the element or use React.cloneElement to make a new element with updated props.”? Inspector is a plain JS React component:

(om/root
  (fn [data owner]
    (reify om/IRender
      (render [_]
        (.createElement (.-React js/window)
                        (.-Inspector js/window)
                        #js {"data" #js {"prop" 123}}))))
  nil
  {:target (. js/document (getElementById "app"))})
(React 0.13.3, Om 0.9.0)

Jakub Holý (HolyJak)21:08:29

Sorry for bothering, according to [om/issues/366](https://github.com/omcljs/om/issues/366) > These are perfectly normal and known to be harmless. Don't worry about them, they won't show in production if you use a minified version of React.