Fork me on GitHub
#reagent
<
2019-05-01
>
Andrew Watts02:05:50

I'm having an issue with (I think) reagent recently. I'm not sure if it's a bug or if I'm doing something wrong. The minimal example of what I'm seeing is here: https://github.com/ahwatts/rtest

Andrew Watts02:05:31

Run boot dev and go to to see it break.

Andrew Watts02:05:27

essentially, it's a minimal reagent app, but it crashes upon the first render because the cljs compiler mangled the name of the ReactDOM.render method.

scknkkrer16:05:40

Hi, has anyone know the rules about the components that takes components as argument.

scknkkrer16:05:02

I have an issue with re-drawing the high-order component.

lilactown16:05:43

can you show your code?

lilactown16:05:06

in general you just need to make sure your higher-order component returns the hiccup appropriately

lilactown16:05:34

Ex.:

(defn my-hoc [foo bar & children]
  ;; we need to make sure that child components are rendered in valid hiccup
  ;; `into` will append `children` to the vector we are returning
  (into
   [:div 
    [:div "foo"] [:div "bar]]
   children))

scknkkrer16:05:57

I am so sorry for the silly question. Here is the trick, Reagent components --Technichally, everything in Clojure/Script-- are functions. I had give the processed reagent element as an argument. If anyone falls this trick. Just return an acceptable reagent element, so Function!