I'm trying to do some refactoring on a function (set-attr) that calls a function (.attr) on a d3 object (node). I want to be able to decouple the object function (.attr) from set-attr.
But I keep getting this error Cannot read property 'each' of null.
I'm hoping someone has experience with d3 interop in Cljs and knows of something that can work, because it works fine on regular js objects.
Function that works
(defn set-attr [node [attr settr]]
(.attr node attr settr))
What I think should work (but gives me the error)
(defn set-attr [node [attr settr]]
((aget node "attr") attr settr))
Works fine on a regular js object
((aget (clj->js {:foo (fn [x y] (str "hi" x y))}) "foo" ) "ryan" "lol")
;; => "hiryanlol"