2

Trying out OM, ReactJS and ClojureScript. I am trying to add a classname to my dom element. Ideally I want something like this:

<div>
    <i class="icon-alert">Contact list</i>
</div>

right now: It writes like:

<div>
    <i>Contact list</i>
</div>

This is my core.clj

(defn new-view [data owner]
  (reify
    om/IRender
    (render [this]
      (dom/i #js {:class "icon-alert"} "Contacts list")
               )))


(om/root new-view app-state
  {:target (. js/document (getElementById "row1"))})

This is the relevant part from my index.html

<div id="row1">
      <h2>Figwheel template</h2>
      <p>Checkout your developer console.</p>
</div>

Any ideas of what I am doing wrong?

Coding Enthusiast
  • 3,865
  • 1
  • 27
  • 50

1 Answers1

4

Playing around with my code, make me realise: I was writing class instead of className. Feel so dumb. It works now. I will let it here so people with the same issues can get the help they need.

(defn new-view [data owner]
  (reify
    om/IRender
    (render [this]
      (dom/i #js {:className "icon-alert"} "Contacts list")
               )))
Coding Enthusiast
  • 3,865
  • 1
  • 27
  • 50