This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-24
Channels
- # beginners (100)
- # calva (11)
- # cider (17)
- # clj-kondo (2)
- # cljdoc (66)
- # cljs-dev (54)
- # clojure (77)
- # clojure-czech (1)
- # clojure-dev (42)
- # clojure-europe (3)
- # clojure-italy (8)
- # clojure-nl (17)
- # clojure-spec (12)
- # clojure-uk (41)
- # clojurescript (68)
- # cursive (8)
- # datomic (15)
- # emacs (9)
- # expound (3)
- # fulcro (14)
- # garden (3)
- # graphql (2)
- # hoplon (2)
- # lein-figwheel (4)
- # leiningen (4)
- # off-topic (22)
- # onyx (8)
- # parinfer (2)
- # planck (1)
- # re-frame (5)
- # reagent (55)
- # reitit (3)
- # remote-jobs (8)
- # shadow-cljs (35)
- # spacemacs (23)
- # sql (3)
- # tools-deps (32)
- # unrepl (8)
- # vim (25)
- # yada (5)
@anantpaatra Have a look at reframe template: https://github.com/Day8/re-frame-template
I can’t figure out why it’s complaining about “`Warning: Each child in a list should have a unique "key" prop.`” when the entire list has unique uuids as the key.
I’ve set the id to be the same as the key and I check manually and it does have them, I have no idea what I could be missing.
React is looking for a metadata “key” property
Oh, right It could be a duplicate key
You’re setting keys with ^{:key some-key-value}
, correct?
Yeah, pull the key out separately, I think?
I never tried putting a key inside the options map, so I won’t say that doesn’t work, but I always use the ^{:key some-key} [:div {...} ...]
style and that seems to work pretty well
I’m more a re-frame guy than straight reagent, so apologies if my habits/assumptions aren’t a good fit
@hobosarefriends the problem is not in that code
assigning the :div
a key inside of the node
component doesn't help tell React which node
instance is unique inside of your collection you're rendering
ex:
(map (fn [node-info] ^{:key (get-in node-info [:child :uuid])} [node node-info]) @current-graph)
for reference the following worked, metadata did not.
(map (fn [node-info] [node {:key (get-in node-info [:child :uuid])} node-info]) @current-graph)])
Thanks for the help!are there already tools that detect wrong arity calls for Reagent component function calls like (defn foo [] [:div [:p "hello"]]) [foo 1 2 3]
? I’m considering this for clj-kondo but one issue is to tell the difference between a Reagent function call or just a vector with some values where the first value is a value referenced by a symbol
yeah, it is difficult. one of the reasons why I enforced a strict [component (optional props) & children]
signature in hx
criteria could be: - .cljs or .cljc file (and only in cljs parts) - reagent.core is required in the namespace
I think most false positives would be resolved that way, but if there’s better criteria, I’d like to know 🙂
hmm. the dream would be that you could follow the call-graph from the point of (reagent.core/render [root-component])
, statically
I’ve also been thinking about that, but I’d like clj-kondo to also function if it doesn’t know the entire project yet
metadata on functions can also work, but I also don’t want people to change code because of a linter, that defeats the purpose
yeah, I think you're always going to run into ambiguity with:
(defn foo [bar]
[baz 1 2 3])
reagent will determine if it matches the following: - keyword? - ifn? if it's neither of those, it believe it will error
then again, how prevalent is code like [x 1 2 3]
in Clojure code… I could write the linter and then see how many times it fails