This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-16
Channels
- # announcements (2)
- # architecture (3)
- # beginners (72)
- # cider (15)
- # cljs-dev (27)
- # clojure (85)
- # clojure-berlin (3)
- # clojure-dev (4)
- # clojure-europe (7)
- # clojure-italy (7)
- # clojure-nl (6)
- # clojure-uk (17)
- # clojurescript (63)
- # clojutre (10)
- # core-async (10)
- # cursive (10)
- # datomic (34)
- # events (4)
- # fulcro (3)
- # funcool (8)
- # incanter (1)
- # jackdaw (1)
- # jobs-discuss (6)
- # joker (4)
- # kaocha (7)
- # leiningen (8)
- # nrepl (6)
- # off-topic (11)
- # reagent (8)
- # shadow-cljs (119)
- # spacemacs (11)
- # sql (11)
- # vim (30)
- # yada (2)
Hi folks. I'm struggling to get :on-load
working with svg in reagent. For example, [:svg {:on-mouse-down #(println "mouse down") :on-load #(println "loaded")}]
prints "mouse down" when I click it but "loaded" never appears. For context (ie in case there's a better way, or I've found a bug) I'm trying to implement the draggable svg components in this tutorial http://www.petercollingridge.co.uk/tutorials/svg/interactive/dragging/ except in cljs. Any ideas of what I'm doing wrong?
I don't see a use of a load event in that tutorial. Are you certain that svg has a load event?
One of the code blocks is
<svg xmlns=""
viewBox="0 0 30 20"
onload="makeDraggable(evt)">
I've tried variations like onload, on-load, onLoad etc in case reagent/hiccup was doing something in between, but haven't had success so farReact doesn't necessarily support all dom events
Anyway, it is probably good idea to lookup similar example for React and adapt that to Reagent. The example manipulates DOM directly which is not good fit for React.
Yeah, I think we found the same threads re react. It was from 2017 or so, so I thought I'd check just in case. Thanks, will look up a react example instead. I appreciate the help!