This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-18
Channels
- # alda (8)
- # aws (1)
- # bangalore-clj (1)
- # beginners (55)
- # boot (114)
- # capetown (2)
- # cljs-dev (51)
- # cljsjs (1)
- # cljsrn (14)
- # clojure (119)
- # clojure-belgium (6)
- # clojure-brasil (9)
- # clojure-conj (2)
- # clojure-greece (1)
- # clojure-korea (2)
- # clojure-poland (12)
- # clojure-russia (64)
- # clojure-spec (12)
- # clojure-uk (60)
- # clojurescript (159)
- # code-reviews (2)
- # component (4)
- # core-matrix (2)
- # cursive (79)
- # datascript (7)
- # datomic (2)
- # defnpodcast (4)
- # events (2)
- # hoplon (13)
- # jobs (2)
- # lein-figwheel (1)
- # off-topic (10)
- # om (42)
- # onyx (60)
- # pedestal (5)
- # perun (7)
- # rdf (4)
- # re-frame (4)
- # reagent (21)
- # ring-swagger (25)
- # schema (1)
- # spacemacs (52)
- # specter (1)
- # utah-clojurians (1)
- # yada (5)
@johanatan you could use webpack or something similiar to generate a bundle with all the deps except react i guess
@edannenberg ya, i thought about that but it seems like a major pain. webpack can take weeks to configure properly lol (which is why people are using ClojureScript to begin with).
a la : https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/ReactCSSTransitionGroup
@johanatan https://github.com/chenglou/react-motion might be worth a look, may or may not a bit overkill. but pretty slick once you wrap your head around it
@johanatan That's what I usually do (and tried for this problem) when I can't derive the :key from the element itself, but in this case interpose
describes exactly what I wanted to do and led to much nicer code (while theoretically not quite as performant)
is there a difference between passing a component multiple arguments versus a map of properties?
[mycontrol show? some-data]
vs
[mycontrol {:show? true :some-data [1 2 3]}]
@joshkh no, think it is just preference. I tend to lean on a map if i have more than two arguments, bc it means the arguments no longer have to be ordered, and will be self-documenting (bc of the keywords)
@curlyfry I wasn't suggesting to get rid of the interpose: merely to change the map
you already have to a map-indexed
thanks @mccraigmccraig I think that providing an always unique key is forcing a full rerender
@johanatan What difference would that make? The interposed [:i]
elements would still lack keys, and the others already have unique keys
@curlyfry oh, sorry. You're right. Why not remove the inner :key from the :i elements and wrap the whole thing in a map-indexed: (map-indexed #(do ^{:key %1} %2) (interpose [] (map ...)))
?
@johanatan Yes, that works, but still pretty verbose which is what I wanted to avoid 🙂 I'm quite happy with the solution using into
. We are talking about something like 3-4 elements so performance isn't really an issue
Okay, so I’ve got https://github.com/FormidableLabs/victory native React components working in a Reagent context. But with a couple of caveats. Maybe you can help me eliminate some of those?
1) In index.html
, I’m including victory.js
from a CDN. But it needs be done after including the compiled cljs, since victory.js
depends on React being available (ie, the global React
javascript variable)
2) Because of this, I cannot use reagent.core/adapt-react-class
in a def
, since Victory is not available when the compiled cljs is evaluated.
@grav There seems to be a http://cljsjs.github.io/ version, why not use that?