reagent

Sam Ritchie 2022-12-02T20:26:55.748479Z

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

Sam Ritchie 2022-12-02T23:10:12.705559Z

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]

Apple 2022-12-02T23:52:59.787479Z

[-1 1] is wrong.

Sam Ritchie 2022-12-02T23:53:32.528159Z

@zengxh haha, can you be more specific?

Sam Ritchie 2022-12-02T23:53:38.993929Z

I am passing a pair of coordinates to a Point component

Sam Ritchie 2022-12-02T23:54:19.029549Z

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

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

Apple 2022-12-02T23:54:20.258799Z

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

Sam Ritchie 2022-12-02T23:54:54.926729Z

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

Apple 2022-12-02T23:54:55.167029Z

oh i see what you are saying

Sam Ritchie 2022-12-02T23:54:56.949389Z

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

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

Sam Ritchie 2022-12-02T23:55:04.566969Z

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

Apple 2022-12-02T23:56:28.841279Z

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

Sam Ritchie 2022-12-02T23:57:17.476799Z

I have an idea…

Sam Ritchie 2022-12-02T23:58:01.878399Z

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 …}]