Search code examples
clojurescriptreagent

What doe this syntax (.-body ...) mean in clojurescript/reagent?


This is from reagent docs.

(defn mountit []
  (r/render-component [childcaller]
                      (.-body js/document))) ; (.-body) what is this?

Solution

  • That is JavaScript interop and accesses the body property of document, same as document.body in JavaScript. See: http://cljs.info/cheatsheet/. So the Reagent component will be mounted at the body element of the page.