Hi, what is the difference between creating a plain js dom element like (.createElement js/document "DIV")
and creating one using om wrappers om.dom/div
?
The om.dom functions wrap React.createElement so (I believe) the latter creates a React element, the former goes straight to the browser DOM.
Correct. First one creates DOM element, the second VirtualDOM element.
Great, thanks.
One way of doing this kind of thing is adding a :ref
to the dom element, which is a fn
that is given the dom element stores a reference to it on the component. (e.g. (fn [el] (set! (.-chartWrapper this) el))
) Then you can access it directly in lifecycle methods to set up / tear down your non-react component.
https://github.com/omcljs/om/blob/master/src/main/om/dom.cljc#L139 @ho0man
Also, om.dom/div
support server-side render(on JVM)