Closed sova closed 7 years ago
If you want to use om.dom/render-to-str
on the CLJS side you need to include a deendency on ReactDOMServer
in your project and require it. Om doesn't bundle ReactDOMServer
since it's an optional feature which isn't very used.
I want to use it is so I can render pages on the server-side in a server.clj file.
Is it possible to include the cljs dependency [cljsjs.react.dom.server] in a Clojure file?
Thanks
If you're trying to use om.dom/render-to-str
from Clojure you don't need a ReactDOMServer
dependency. You certainly didn't get that error from Clojure, since what you pasted originally is a JavaScript error.
You are right, that was a js error, not a clojure one.
I finally got it working, thank you so much for your help.
For any other newcomers, make sure that in your server.clj file you have
[om.next :as om :refer [defui]]
in your :require statement.
nf-starter-january.core=> (dom/render-to-str (blurb boo))
object[ReferenceError ReferenceError: ReactDOMServer is not defined]
ReferenceError: ReactDOMServer is not defined
[org.omcljs/om "1.0.0-alpha45"]
(it could just be an error on my part, but perhaps someone more experienced can take a look.)