A minimalistic ClojureScript interface to React.js
Jason 2020-08-12T19:36:03.168900Z

Hello. I have an issue which has me stumped. I'm pretty new to front end work and am trying to translate a minimal into cljs. My translation renders, and events fire but :onMouseEnter and :onMouseLeavetake turns firing while the mouse is motionless over the anchor element, so the popup never shows (or at least not for long). I think I must be misunderstanding something. Any help appreciated.

(defn hover-sample [{:keys [^js classes]}]
  (let [local-state (reagent/atom {:hover nil})]
    (fn []
      [:> Paper {:class [(.-paper classes) (.-fixedHeight classes)]}
        [:> Typography {:id "hover-anchor"
                        :aria-owns #(if (nil? (:hover @local-state))
                        :aria-haspopup "true"
                        :onMouseEnter #(prn (swap! local-state assoc :hover
                                                   (-> %
                        :onMouseLeave #(prn (swap! local-state assoc :hover
         "Hover with a popover"]
        [:> Popover {:id "mouse-over-popover"
                     :className (.-popover classes)
                     :classes {:paper (.-paper classes)}
                     :open (not= nil (:hover @local-state))
                     :anchorEl #(if (nil? (:hover @local-state))
                                  (.getElementById js/document
                     :anchorOrigin {:vertical "bottom"
                                    :horizontal "left"}
                     :transformOrigin {:vertical "top"
                                       :horizontal "left"}
                     :onClose #(swap! local-state assoc :hover nil)
                     :disableRestoreFocus true
                     :disableEnforceFocus true
                     :disableAutoFocus true}
         [:> Typography "I use Popover."]]]])))


@jasonhlogic I haven’t looked to much your example, but the first thing I noticed was the declaration of the render function


you are implementing a form-2 type component


and the returned fn should have the same params as the container fn

Jason 2020-08-13T16:42:08.171Z

Many thanks for having a look. I'm reading the documentation you linked.