reagent 2022-12-02

Just released a reagent component for interactive equation editing, thought it might be interesting here! https://clojurians.slack.com/archives/C06MAR553/p1670012763440319

hey all - is there some way to pass a vector as a child to a React component? I am getting Uncaught Error: Assert failed: Invalid Hiccup form: [-1 1]

[-1 1] is wrong.

@zengxh haha, can you be more specific?

I am passing a pair of coordinates to a Point component

;; this works fine:
(defn Point [opts coords]
  ...)

[Point {:name "A" :size 4}
 [-1 1]]

it's usually [:div "xyz" "-1" "1"]

strings won’t work, these are floating point coordinates of a point

oh i see what you are saying

(def Point
  (re/adapt-react-class
   (react/forwardRef
    (fn [props ref]
      ...))))

[Point {:name "A" :size 4}
 [-1 1]]

this fails before the inner function is ever called with that error

does '(-1 1) work? i dnot know how to solve this.

I have an idea…

I think if I really need to do this i can make an outer component that takes the vector and stuffs it into props under some key like :coords , then returns [InnerPoint {:coords …}]