Fork me on GitHub

Is it possible to import a cljs namespace from a js file?

Daniel Craig21:08:46

Hi @dnolen! We've got a meetup over in #mid-cities-meetup and we're looking for speakers over the next 3 months or so. Would you be interested in proposing a topic and presenting?

Justin Roche21:08:11

How would I get a tutor? I mainly need to go through the build chain for a template, there are many pieces here...

Kasey Speakman21:08:35

I am an experienced dev but new to Clojure. I primarily work in web. I made a thing that is probably dumb -- a basic MVU loop on top of reagent -- but it would be nice to get some feedback here.


hello. i am trying to translate material-ui js samples to cljs as a first time front end writer the the code i'm copying under the <>button. My best guess is

(defn hover-sample [{:keys [^js classes]}]
  (let [local-state (reagent/atom {:hover ""})]
    (fn []
      [:> Paper {:class [(.-paper classes) (.-fixedHeight classes)]}
        [:> Typography {:id "hover-anchor"
                        :aria-owns #(if (not= "" (:hover @local-state))
                        :aria-haspopup "true"
                        :onMouseEnter #(swap! local-state assoc :hover
                                              (-> %
                        :onMouseLeave (swap! local-state assoc :hover "")}
         "Hover with a popover"]
        [:> Popover {:id "mouse-over-popover"
                     :className (.-popover classes)
                     :classes {:paper (.-paper classes)}
                     :open #(not= "" (:hover @local-state))
                     :anchorEl #(.getElementById js/document "hover-anchor")
                     :anchorOrigin {:vertical "bottom"
                                    :horizontal "left"}
                     :transformOrigin {:vertical "top"
                                       :horizontal "left",}
                     :disableRestoreFocus true}
         [:> Typography "I use Popover."]]]])))
which renders correctly BUT the Popover is always visible, i.e. #(not= # (not= "" (:hover @local-state))) ` is always true. I am making a dumb mistake somewhere. Any help appreciated I can see the above code re-render twice when the page loads.