Fork me on GitHub
#reagent
<
2016-11-29
>
martinklepsch03:11:24

@mikethompson for the future, this is where you look for cljsjs stuff: http://cljsjs.github.io/ (or straight in the packages repo on github)

mikethompson04:11:30

@martinklepsch thanks, yeah, I went off in the wrong direction. All clear now.

pesterhazy08:11:14

@martinklepsch is it worth submitting a PR to cljsjs for usage instructions like this? https://clojurians.slack.com/archives/reagent/p1480370785005662

martinklepsch15:11:54

@pesterhazy not sure where you'd put it but at the very least a note in the wiki would be a good idea I'd say

martinklepsch15:11:22

Or you could add the same info to all the react-* packages

pesterhazy15:11:47

although part of the challenge is to find out which js global a cljsjs package exports

martinklepsch15:11:17

@pesterhazy I guess in that case it should be in the package readme

joshkh18:11:00

Could someone help me understand why I'm getting a warning about keys in this scenario? I'm trying to dispatch different reagent components based on a :type in a map.

(defn comp-a []
  (fn [args]
    [:div
     [:span "I am compa"]
     args]))

(defmulti panels (fn [x] (:type x)))
(defmethod panels :component-a [_ & args] [comp-a args])

(defn main []
  (fn []
    [:div [panels {:type :component-a} [:h1 "Test"]]]))
Warning: Each child in an array or iterator should have a unique "key" prop.

joshkh18:11:04

son of a... i'm not destructuring [args]

joshkh18:11:23

well since i'm here, is there a best practice for mounting different components based on a type like in my example?

joshkh18:11:00

i could have a case statement just as easily i suppose

joshkh18:11:45

i guess in a way i'm interested in extending components?

pbaille19:11:58

Hi! Lately i’ve played a little with reagent.core/wrap and i’ve been a bit frustrated that it was not reactive like others reagent "ref » types. So i’ve tried to write it myself. Is it a terrible idea? why? gist: https://gist.github.com/pbaille/6616353731efe5bfa00869c6338b03c7

pesterhazy20:11:55

@joshk, there are known gotchas with using defmethods as components

pesterhazy20:11:42

you could use a wrapper that calls the defmethod, or just do (panels ...) instead of [panels ...]

pesterhazy20:11:36

tbh I never really understood what the issue with reagent+defmethods was

mikethompson21:11:15

@joshk @pesterhazy is right - best to stay away from multimethods as components. See http://stackoverflow.com/a/33487691/5215391